feat(media): support HEIC/HEIF images for iPhone uploads#92
Open
yangxin317 wants to merge 1 commit into
Open
Conversation
iPhones default to HEIC (High Efficiency Image Container, the still-image
companion to HEVC) since iOS 11, but `load_media` filters them out via
the `IMAGE_EXTS` whitelist. The user-visible symptom is the assistant
saying "几张 .heic 图片被跳过了" right after upload, which forces users
to convert before each session.
This change:
* Adds `.heic` / `.heif` to every image-extension whitelist in the
pipeline: `load_media`, `generate_ai_transition`, `render_video`,
`media_handler`, and `sampling_handler` (so MCP samples and renders
pick them up too).
* Registers the HEIF opener with Pillow on package import, so any code
path that goes through `PIL.Image.open()` transparently decodes HEIC
without per-call branching.
* Adds `pillow-heif==1.3.0` to `requirements.txt`. The opener
registration is wrapped in `try/except ImportError` so the change
remains forward-compatible with existing environments that haven't
reinstalled requirements yet — they keep the previous behavior of
filtering HEIC out via the suffix whitelist.
## Test plan
- [x] Decoded a 4284×5712 iPhone 15 HEIC via `PIL.Image.open()` after
`import open_storyline`.
- [x] Verified `load_media.IMAGE_EXTS` now contains both `.heic` and
`.heif`.
- [x] Confirmed regular `.jpg / .png / .webp` paths unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iPhones default to HEIC (High Efficiency Image Container) since iOS 11, but
load_mediafilters them out via theIMAGE_EXTSwhitelist. End users see the assistant reportright after upload, and have to manually convert each batch with Preview / sips / online tools before they can use OpenStoryline at all.
Changes
.heic/.heifto every image-extension whitelist along the pipeline:nodes/core_nodes/load_media.pynodes/core_nodes/generate_ai_transition.pynodes/core_nodes/render_video.pyutils/media_handler.pymcp/sampling_handler.pyopen_storyline/__init__.py), so every code path that usesPIL.Image.open()transparently decodes HEIC without per-call branching.pillow-heif==1.3.0torequirements.txt.The opener registration is wrapped in
try / except ImportError, so the package still imports cleanly in environments that haven't reinstalled requirements — they fall back to the previous suffix-filter behavior.Test plan
PIL.Image.open()afterimport open_storylineload_media.IMAGE_EXTSnow contains both.heicand.heifload_mediaand progresses pastunderstand_clips.jpg / .png / .webpuploads remain unchangedAffected files
src/open_storyline/__init__.pysrc/open_storyline/utils/media_handler.py.heic .heifsrc/open_storyline/nodes/core_nodes/load_media.py.heic .heifsrc/open_storyline/nodes/core_nodes/generate_ai_transition.py.heic .heifsrc/open_storyline/nodes/core_nodes/render_video.py.heic .heifsrc/open_storyline/mcp/sampling_handler.py.heic .heifrequirements.txtpillow-heif==1.3.0(unrelated to PR #91 which fixes Spatial Video
apacaudio streams)