Skip to content

feat(media): support HEIC/HEIF images for iPhone uploads#92

Open
yangxin317 wants to merge 1 commit into
FireRedTeam:mainfrom
yangxin317:feat/support-heic-images
Open

feat(media): support HEIC/HEIF images for iPhone uploads#92
yangxin317 wants to merge 1 commit into
FireRedTeam:mainfrom
yangxin317:feat/support-heic-images

Conversation

@yangxin317
Copy link
Copy Markdown

Summary

iPhones default to HEIC (High Efficiency Image Container) since iOS 11, but load_media filters them out via the IMAGE_EXTS whitelist. End users see the assistant report

抱歉,有几张 .heic 格式的图片被跳过了,因为目前不支持这种文件类型

right after upload, and have to manually convert each batch with Preview / sips / online tools before they can use OpenStoryline at all.

Changes

  1. Adds .heic / .heif to every image-extension whitelist along the pipeline:
    • nodes/core_nodes/load_media.py
    • nodes/core_nodes/generate_ai_transition.py
    • nodes/core_nodes/render_video.py
    • utils/media_handler.py
    • mcp/sampling_handler.py
  2. Registers the HEIF opener with Pillow once on package import (open_storyline/__init__.py), so every code path that uses PIL.Image.open() transparently decodes HEIC without per-call branching.
  3. Adds pillow-heif==1.3.0 to requirements.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

  • Decoded a 4284×5712 iPhone 15 HEIC via PIL.Image.open() after import open_storyline
  • Confirmed load_media.IMAGE_EXTS now contains both .heic and .heif
  • Re-uploaded a batch of nine iPhone HEICs to a live MCP/Web instance — every file is now picked up by load_media and progresses past understand_clips
  • Regular .jpg / .png / .webp uploads remain unchanged

Affected files

File Change
src/open_storyline/__init__.py register HEIF opener
src/open_storyline/utils/media_handler.py + .heic .heif
src/open_storyline/nodes/core_nodes/load_media.py + .heic .heif
src/open_storyline/nodes/core_nodes/generate_ai_transition.py + .heic .heif
src/open_storyline/nodes/core_nodes/render_video.py + .heic .heif
src/open_storyline/mcp/sampling_handler.py + .heic .heif
requirements.txt + pillow-heif==1.3.0

(unrelated to PR #91 which fixes Spatial Video apac audio streams)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant