xtract.bot
POST /api/heic-to-avif

Convert HEIC / HEIF (the iPhone capture format) to AVIF. Configurable quality / encoder effort, optional lossless mode, edge-cached.

Takes an HEIC or HEIF image and returns the same picture as AVIF. AVIF is the most efficient modern image format — typically 30–50% smaller than JPEG at visually equivalent quality. Quality is 0–100 (default 50; 50 ≈ JPEG q80). Higher quality preserves more detail but produces larger files. The encoder also exposes an `effort` tradeoff: higher numbers encode slower but produce smaller output. Set `lossless: true` for a pixel-perfect round-trip (the HEIC itself is still lossy upstream, but no further loss is added). Both HEIC and AVIF are ISO-BMFF containers using HEVC (HEIC) and AV1 (AVIF) respectively, so there is no codec lineage — the pixels are decoded and re-encoded. Animated HEIC sequences are not supported — only the primary image is converted. Limits to be aware of: - Maximum image size: 5 megapixels. - iPhone tile-grid captures (full-resolution photos with the HDR gain map) are rejected with a clear error pointing you to re-export the photo at a lower resolution first.

Inputs

NameTypeDefaultDescription
image*fileHEIC or HEIF image bytes.
qualitynumber (0…100)50AVIF visual quality 0–100 (50 ≈ JPEG q80). Ignored when lossless=true.
effortnumber (0…10)4Encoder effort 0–10. Higher = smaller file, more CPU.
losslessbooleanfalseWhen true, encode losslessly from the decoded HEIC pixels. `quality` is ignored.

Response

Modes: binary, json. Cache: yes (24h TTL).