In order to optimize (and reduce) the storage needs, we’re currently exploring the pro and cons to use JPEG-XL (JXL) instead of JPEG for Panoramax.
JPEG-XL has many interesting features:
- lossless conversion from and back to JPEG (bit perfect)
- more efficent compression (20% saving on JPEG lossless)
- tiling up to 1024x1024 pixels
- progressive decompression
- HDR support
On 360° pictures, we could save 60% of storage and still 20% on non 360 pictures !
Of course, to support viewers that are not JXL compatible (all of them right now), some fallback is required to provide JPEG content and not only JXL.
One possible scenario could be:
- upload in JPEG or JXL
- lossless conversion of JPEG to JXL (this allows to retrieve the original JPEG)
- directly serve JXL for compatible viewers
- on demand reverse conversion to JPEG for incompatible viewers and backward compatibility
thumbnails could be store in JPEG as they consume marginal storage.
The on-demand conversion would provide:
- low definition version (taking advantage of progressive JLX decompression)
- tiles generation (taking advantage of large JXL tiles)
- original JPEG conversion
JXL compatible viewers would need to be smart enough to take advantage of the “cloud optimized” nature of JXL. By requesting byte ranges from the single JXL file, it is possible to directly access and transfer only the part that are needed for display, including a low resolution and tiles.
Of course, this means more development that simply being able to display JXL but this can make the viewer more responsive and limit the amount of data tranfered over the network.
On demand conversion means CPU resources, which are linked to how frequent pictures are used, some cache could reduce the load on some images that are frequently accessed.
If Panoramax default viewer support JXL directly, this will limit the need for additional CPU resources at the server level.
On the other side, storage is linked to how many pictures are available, independently of the viewer and we know that this is constantly increasing and is the cotsy part of runing a Panoramax instance.
libjxl has been greatly improved and now provides quite fast processing by using SIMD AVX code optimized for today’s CPUs.
On large JPEG pictures (96Mpx), the tests are showing that a full reverse conversion to JPEG areusually below 1s (single thread) and even lower in multi-thread.
One more thing ![]()
When JPEG is lossly recompressed to JXL, the gain in size can be much higher with typically -60% instead of -20% !
This could be used on older pictures to keep as archives with some loss.