← Back

Display JPEG XL images using the <img> tag

This demo shows how a JPEG XL (.jxl) image can be displayed in any browser-even if the browser does not natively support the format. As of the publication date, this format is not natively supported by Firefox or Chrome.

If your browser supports JPEG XL natively, it may decode directly. Otherwise, the WebAssembly pipeline handles the decoding transparently.

Code snippet

We decode a jxl file zoltan-tasi-CLJeQCr2F_A-unsplash.jxl using the universal img tag :

<img is="universal-img"
     src="../test_sequences/zoltan-tasi-CLJeQCr2F_A-unsplash.jxl"
     using="solver_1"
     with="libjxl_1">
</img>

Specifications :

The specifications of the test sequence are :

Format jxl
FileSize 420 kB
Dimension 896 x 1080 pixels
Color sRGB
Precision 32 bits