novomesk / qt-jpegxl-image-plugin

Qt plug-in to allow Qt and KDE based applications to read/write JXL images.
GNU General Public License v3.0
91 stars 8 forks source link

Progressive image decoding prevents decoding entirely #8

Closed BlueSwordM closed 3 years ago

BlueSwordM commented 3 years ago

Hello again.

I have an interesting issue now: it seems like the QT-JXL plugin can't handle progressive images due to the way they are being decoded and shown.

Here is the error in question:

[INFO] Hi there [INFO] plugins dir set to: "/usr/lib64/nomacs-plugins" [INFO] local client created in: 1 ms [INFO] theme loaded from "/usr/local/share/nomacs/Image Lounge/themes/Light-Theme.css" [INFO] CSS loaded from: ":/nomacs/stylesheet.css" [INFO] Initialization takes: 80 ms [INFO] [DkImageLoader] 5 containers created in 0 ms [INFO] [DkImageLoader] after sorting: 0 ms [WARNING] Unexpected event 1024 instead of JXL_DEC_NEED_IMAGE_OUT_BUFFER [WARNING] Unexpected event 1024 instead of JXL_DEC_NEED_IMAGE_OUT_BUFFER [WARNING] [Basic Loader] could not load "/home/bluezakm/Pictures/Dark/Low BPP/D3.jxl"

Image link: https://cdn.discordapp.com/attachments/804324493420920833/816382162370560021/Screenshot_20210302_135048.png

It seems like since it's a progressive image, the plugin expects things to happen in a specific order, which might not always be the case: https://github.com/novomesk/qt-jpegxl-image-plugin/blob/main/src/qjpegxlhandler.cpp#L282

Some references on the manner: https://gitlab.com/wg1/jpeg-xl/-/blob/master/lib/include/jxl/decode.h#L285 https://gitlab.com/wg1/jpeg-xl/-/blob/master/lib/include/jxl/decode.h#L205

I hope this will be helpful. :+1:

novomesk commented 3 years ago

Thank you for the report and the way how to create these test files.

Related issue: https://gitlab.com/wg1/jpeg-xl/-/issues/157

BlueSwordM commented 3 years ago

The temporary fix you implemented fixed it. :D

novomesk commented 3 years ago

Someone can still use the previous version. The workaround makes no harm. I will remove it when/if libjxl API changes.