Make HEIC decoding an optional [heic] extra backed by pillow-heif - #530
Merged
Merged
Conversation
pi-heif is discontinued upstream: its final release, 1.4.0, bundles libheif 1.23.0, which is affected by the security advisories fixed in libheif 1.23.2 and 1.23.3 (including CVE-2026-84383). The default install no longer depends on it. `pip install "roboflow[heic]"` installs pillow-heif>=1.7.0 (libheif 1.23.3), and image_utils registers its Pillow opener when it is installed. It never registers pi-heif, so environments that still have the old wheel stop decoding HEIC with it. The extra is opt-in because pillow-heif's binary wheels bundle the x265 encoder, which makes them GPL-2.0 (#398). Uploads and Project.check_valid_image() do not decode images, so they handle HEIC without the extra. Decoding a local HEIC file needs it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The CHANGELOG's Unreleased section becomes 1.5.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
digaobarbosa
approved these changes
Sep 18, 2026
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.
What this does
Makes HEIC/HEIF decoding an optional extra backed by
pillow-heif, and removespi-heiffrom the default install.requirements.txt: dropspi-heif<2.setup.py: adds aheicextra,pip install "roboflow[heic]", which installspillow-heif>=1.7.0.roboflow/util/image_utils.py: registers thepillow_heifPillow opener when it is installed, with the sameregister_heif_opener(thumbnails=False)call. It never registerspi_heif.pyproject.toml: addspillow_heif.*to the mypy optional-import overrides, next toIPythonandipywidgets.tests/util/test_image_utils.py: covers both registration rules, thatpillow_heifis registered when importable and thatpi_heifis not.README.mdandCHANGELOG.mddocument the extra and its licence.Why
pi-heifis discontinued: 1.4.0 is its final release (bigcat88/pillow_heif#431). That release bundles libheif 1.23.0, which is affected by the libheif security advisories fixed in 1.23.2 and 1.23.3, including CVE-2026-84383, a critical heap overflow reachable from crafted HEIC and AVIF files. Thepi-heif<2pin can never resolve to a fixed build.Because
image_utilsregistered the opener at import time, every process that importedroboflowalso gained a native HEIF parser for all laterPIL.Image.opencalls, including processes that never handle HEIC on purpose.pillow-heif1.7.0, the maintained package from the same project, bundles libheif 1.23.3 and libde265 1.1.2. Its binary wheels also bundle the x265 encoder, which makes them GPL-2.0. That is the reason for #398 and for the move topi-heif, so the dependency is opt-in rather than a default requirement.Impact on users
Project.upload()sends the original bytes, andProject.check_valid_image()detects HEIC from its magic bytes withfiletype. Neither decodes the image, and the server handles the HEIC.model.predict("photo.heic")with a local file, the two-stage helpers, and the prediction plotting utilities. Without it they raise Pillow'sUnidentifiedImageError.pi-heifis still installed,roboflowno longer registers it. HEIC decoding stops until the user installsroboflow[heic]. The CHANGELOG entry says so.roboflow-slimis unchanged; it never importedimage_utils.Verification
pip install ".[dev]"make check_code_qualitypasses.python -m unittest: 1040 tests OK.pip install ".[heic,dev]"pillow-heif1.7.0 (libheif 1.23.3) installed.import roboflowregisterspillow_heif.as_plugin.tests/images/sky-rabbit.heicdecodes (HEIF, RGB, 432×640), andfile2jpegconverts it. Full test suite OK.pi-heif==1.4.0UnidentifiedImageError.🤖 Generated with Claude Code