saschanaz / jxl-winthumb

A JPEG XL (*.jxl) thumbnail handler for Windows File Explorer.
ISC License
375 stars 17 forks source link

Some JXL Files Aren't Viewable #32

Closed Tumbolisu closed 1 year ago

Tumbolisu commented 1 year ago

I have recently started converting many PNG files to JXL for compact long-term storage. Since I still want to be able to see what each file is, I naturally was interested to install this piece of software.

However, some images, after being converted to JXL, can not be previewed at all by this software. There is no thumbnail, and the Windows Photo Viewer refuses to open them. Other programs, such as Krita and the official JXL decoder "djxl.exe", have no issue. That at the very least means that the files themselves aren't corrupt.

I'm not sure how I can help other than to upload some of these anomalous files.

I'm using v0.2.2 on Windows 10 Pro, version 22H2, build 19045.3324.

anomalous-jxl-files.zip

saschanaz commented 1 year ago

You are probably suffering from https://github.com/tirr-c/jxl-oxide/issues/65, for now you can downgrade to 0.1.x as a workaround. The issue is fixed in upstream but I'm still waiting because there has been no new release since then.

Aerocatia commented 1 year ago

ping, jxl-oxide v0.4.0 is out.

saschanaz commented 1 year ago

Fixed by 81aafce43bc1778aa657bcc9d60d7711e2345667

Tumbolisu commented 8 months ago

Release v0.2.5 has finally fixed this for me! All my files have thumbnails and can be viewed in Windows Photo Viewer.

Aerocatia commented 8 months ago

Interesting, so you really hit a different bug all along. You may want to follow https://github.com/libjxl/libjxl/issues/3356, The images you have been converting are not conformant to the JXL spec due to a implementation bug.

jxl-oxide has introduced a code path to check for this and decode such files, I don't think libjxl has completely decided how they will handle this yet.

Tumbolisu commented 8 months ago

Then I should probably mention how I made these files. I used libjxl's cjxl.exe (--version outputs cjxl v0.9.0 a185c22 [AVX2,SSE4,SSSE3,SSE2]) with the following command:

cjxl.exe [input_file] [output_file] -q 100 -e 9 -v

As I said, only a few files couldn't be viewed by older versions of jxl-winthumb (pre v0.2.5). Maybe like 2% of them in total.

Aerocatia commented 8 months ago

-q 100 -e 9 is equivalent to -d 0 -e 9. The -q option is a weird wrapper around -d that intends to mimic jpeg usage somewhat, whereas -d is the real underlying quality setting.

Images compressed with -d 0 and either -e 8 or -e 9 have a small chance of being invalid due to a bug in libjxl. The image pixel data is fine, but the bitstream does not completely conform to the JPEG-XL standard. Because the bug affected libjxl's decoder too, such images will also decode fine with libjxl. When it comes to jxl-oxide, a workaround was recently added to load such images and that is why they work now in jxl_winthumb.

In short you may want to consider re-compressing the affected images with -e 7 because it is not known if they will be supported forever in every future JPEG-XL decoder. There is also a possibility the standard itself might be changed to include these images but a decision has not been made yet. Compressing with -e 7 Will ensure the images are standard compliant and will always work.

Aerocatia commented 8 months ago

Sorry for the noise but it is looking like they will adjust the JPEG-XL spec to match current images, so you will not have to do anything.