v155 · jpeg xl

Decode probe

There is no registry to ask whether a browser supports an image format — you decode a file and see. Four different ways of asking, run against a real 30 KB .jxl, because they can disagree: the Accept header advertises intent, and only a successful decode is proof.

Ask four ways

Running…

Each probe, and what it actually tells you
proberesultwhat it proves

The file itself

On the left, the .jxl in an <img>. On the right, the same source as PNG so you can see what it should look like. If the left pane is blank, this browser cannot decode JPEG XL — which is the honest outcome on anything before Chrome 155.

A generated test image with gradients, circles and a caption, encoded as JPEG XL.
image.jxl — 30,183 bytes
The same test image as a PNG, for reference.
source.png — 181,800 bytes

code path

// The only probe that proves decoding: get bytes, decode them, look for
// a bitmap. Everything else is an assertion of intent.
const response = await fetch("photo.jxl");
const supported = await createImageBitmap(await response.blob())
  .then((bitmap) => { bitmap.close(); return true; })
  .catch(() => false);

see also