Skip to content

Open HEIC, HEIF, and WebP photos in the editor - #49

Merged
joancomadran merged 1 commit into
mainfrom
cursor/heic-webp-import-a6ad
Nov 27, 2026
Merged

joancomadran merged 1 commit into
mainfrom
cursor/heic-webp-import-a6ad

Conversation

@joancomadran

Copy link
Copy Markdown
Owner

Summary

The editor can open WebP, HEIC, and HEIF photos entirely in the browser. Nothing is uploaded.

WebP (.webp, image/webp) uses the same path as JPEG and PNG: the file picker accepts it, the browser decodes it, the session stores the original file, and export keeps the filename stem (frame.webp → frame-edited.jpg with the default pattern).

HEIC/HEIF (.heic, .heif, image/heic, image/heif, plus the sequence MIME types):

  • Decoder: heic-to 1.6.7, which wraps libheif 1.23.7 and libde265 (LGPL-3.0). It is the current browser build, it decodes in a worker, and it frees each libheif image and context after the file. heic2any is older and its MIT claim over libheif is disputed; a hand-rolled libheif-js worker would duplicate what heic-to already does, and nesting another worker breaks Safari.
  • Native decode runs first (createImageBitmap with imageOrientation: 'from-image'). Safari keeps the system decoder’s resolution, orientation, and color. If that fails, the editor dynamically imports heic-to/next. The import is not in the editor chunk and is not precached by the service worker, so the first visit does not download the ~3.2 MB decoder.
  • The working image is a JPEG at quality 0.95 so later edits and export have a full-size bitmap. Export uses the original stem: IMG_1234.heic with the pattern {name} is IMG_1234.jpg; the default pattern {name}-edited is IMG_1234-edited.jpg.
  • A batch stays sequential. The status line shows Decoding IMG_1234.heic… (1/2) while each file runs. A corrupt file toasts Could not decode broken.heic. The HEIC file may be corrupted. and does not drop the photos that opened.
  • Object URLs for a failed open are revoked. The native canvas is shrunk after encode. heic-to releases the libheif context per file; its worker stays up so the next HEIC in the batch does not compile WASM again.

Editor copy (EN and ES) now lists HEIC and WebP on the empty-state chips, the Open button, the filmstrip, and the unsupported-type message. Page titles, meta descriptions, H1s, and Amazon affiliate links are unchanged. Privacy copy stays “Nothing uploaded” / “Sin subir archivos”.

Verification

  • npm test — 52 passed, including acceptance, native-then-WASM decode, corrupt HEIC errors, and export stems
  • npm run lint
  • npm run build (astro check + production build). Decoder chunk: dist/_astro/heic-to.*.js (~3.2 MB), absent from dist/sw.js
  • npx playwright test — 34 passed. WebP opens without requesting the decoder. A HEIC + HEIF batch opens, and a corrupt HEIC shows the error toast

Format hints

HEIC and HEIF opened

WebP opened

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Accept the formats in the file picker and decode HEIC/HEIF in the browser. Native decode is used when the browser can do it; otherwise heic-to loads only for that file.

Co-authored-by: Joan Comadran <joancomadran@users.noreply.github.com>
@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lightframes Ready Ready Preview Nov 27, 2026 7:28am UTC

Request Review

@joancomadran
joancomadran merged commit 7667dfc into main Nov 27, 2026
5 checks passed
cursor Bot pushed a commit that referenced this pull request Nov 27, 2026
Update FAQ JSON-LD, llms.txt summary, home steps, about, iPad and
Chromebook platform pages, and Fotoreto comparison tables so site text
matches HEIC/HEIF and WebP input after PR #49, including honest HEIC
decoder download notes where relevant.

Co-authored-by: Joan Comadran <joancomadran@users.noreply.github.com>
joancomadran added a commit that referenced this pull request Nov 27, 2026
…mparativa Fotoreto (EN/ES) (#50)

Update FAQ JSON-LD, llms.txt summary, home steps, about, iPad and
Chromebook platform pages, and Fotoreto comparison tables so site text
matches HEIC/HEIF and WebP input after PR #49, including honest HEIC
decoder download notes where relevant.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Joan Comadran <joancomadran@users.noreply.github.com>
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.

2 participants