Repository navigation
Send HEIC straight to the browser decoder - #19
Merged
Merged
Conversation
libvips recognises HEIF but has no HEVC decoder, so trying it first only cost time and logged three "VIPS-WARNING: error in tile" lines. The file's ftyp brands now decide: HEVC-coded HEIF skips libvips. AVIF, also HEIF, still goes to libvips. The same check picks the HEIC message, so a HEIC named .jpg gets it too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01STHRjFYWhkJBxSKG3tJdap
Deploying image-optimizer with
|
| Latest commit: |
6028769
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0dd9480e.image-optimizer-7ba.pages.dev |
| Branch Preview URL: | https://fix-heic-straight-to-browser.image-optimizer-7ba.pages.dev |
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.
Follow-up from checking staging. In Chrome and Firefox, adding a HEIC logged three
VIPS-WARNING: error in tilelines in the console. libvips recognises the HEIF container but has no HEVC decoder, so it failed partway through decoding before the browser fallback ran. The warnings were console-only; users saw the right message.Change
src/lib/heif.tsreads the file's first 256 bytes (theftypbox). If the brands mark it as HEVC-coded HEIF (heic,heix,hevc, …), it skips libvips and goes straight to the browser decoder..jpggets "This browser can’t open HEIC…" instead of "Can’t read this file".Tests
photo.jpggets the HEIC message, with no console errors. It fails without the fix.🤖 Generated with Claude Code
https://claude.ai/code/session_01STHRjFYWhkJBxSKG3tJdap