Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I don't think you can ever convert to a regular JPEG and the outcome will be lossless. Like Webp ,JPEG XL has a lossless setting but it has to remain there.


I tried it on my computer. Converting from JPEG to JPEG XL and then back to JPEG gets you a bit-wise identical JPEG file.


I'm guessing the opposite (XL -> JPEG -> XL) does not work, i.e., "losslessly convert back and forth with regular JPEG".


I think the issue at hand is that behind the scenes, JPEG XL the image format actually combines three different kinds of image compression algorithms:

1. native JPEG XL lossy compression

2. JPEG lossy compression, but using a more space-efficient storage format than classic JPEG

3. lossless compression

The lossless conversion between JPEG XL and JPEG only works with 2).

Normally you'd only use 2) for existing JPEG images in order to avoid a lossy re-compression, and use 1) for any freshly-created images because native JPEG XL compression will compress the image data even more efficiently than the JPEG compatibility-mode, though if you've got strong interoperability constraints with clients requiring JPEG data you might possibly want to store even newly created images using sub-format 2) in order to get the ability to losslessly convert back and forth between JPEG XL and JPEG.


Just tried it and JPEG -> XL -> JPEG -> XL is bit-wise identical between the two JPEGs and bit-wise identical between the two JPEG XLs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: