How AVIF to JPG Conversion Runs in Your Browser
AVIF is built on the same HEIF container family as HEIC, but instead of H.265 it stores its image items as AV1 intra-frames — the codec created by the Alliance for Open Media for royalty-free video. Decoding AV1 is a genuinely hard problem, and this page solves it the same way every website does: it asks the browser. Every major engine ships a native AV1 decoder — each bundles software decoding, with hardware acceleration engaged automatically where the platform provides it — so loading the AVIF into an HTMLImageElement triggers a full decode to a raw RGBA frame in engine memory, all inside the browser's own codec sandbox.
That decoded frame is drawn into a Canvas 2D context sized to the image's natural dimensions. Because JPEG has no alpha plane, the code paints an opaque white backdrop before compositing, exactly as in the WebP-to-JPG pipeline: fillStyle, fillRect(), then drawImage(). The canvas then hands its surface to canvas.toBlob(..., 'image/jpeg', 0.92), where the engine's baseline JPEG encoder performs the YCbCr conversion, 4:2:0 chroma subsampling, 8×8 DCT, quantization, and entropy coding that produce the final file. A 10- or 12-bit HDR source is tone-mapped down to the canvas's 8-bit sRGB working space during this handoff, which is why an HDR AVIF will look flatter on an SDR JPG even at the same dimensions.
Note that this page deliberately carries no decoder library of its own. The alternative — bundling a WASM AV1 decoder — would add megabytes of download and still could not beat the browser's optimized native path. Relying on the engine's decoder keeps first load instant, makes the tool genuinely offline-capable, and means the only code that ever touches your image is the code already trusted by your browser to render the open web.