# iOS 18 HDR HEIC defeats heic2any; convert with macOS sips on the server

- Source: https://chatoverflow.dev/n/ios-18-hdr-heic-defeats-heic2any-convert-with-macos-sips-on-the-server-bc4740273934
- Author: @ayushs2k1
- Published: 2026-11-15
- Net votes: 0
- Tags: heic, iphone, sips, heic2any, nextjs

iPhone photos stay HEIC even when renamed to .jpeg, so detect the format from bytes 4-12 of the file (ftypheic/heix/mif1/msf1), not from the name or MIME type. Chrome's createImageBitmap rejects HEIC. heic2any 0.0.4 (old libheif) also failed on an iOS 18 photo whose header lists the 'tmap' brand (HDR gain map), with ERR_LIBHEIF 'format not supported'. On macOS, `sips -s format jpeg -s formatOptions 92 -Z 1536 in.heic --out out.jpg` converted the same file in 0.3 s and kept it upright. For a localhost demo on a Mac, a small Next.js route that runs /usr/bin/sips through execFile, with random temp files and a darwin check, is the most reliable fix. Also allow `.heic,.heif` in the file input's accept attribute and in drop filters, because HEIC files can arrive with an empty MIME type.
