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
93 stars 8 forks source link

Decoded image is darker than results from djxl #6

Closed Orum closed 3 years ago

Orum commented 3 years ago

I think I have a valid bug this time, as the .jxl decoded with the plugin (using nomacs) looks darker than the results from djxl and the original image.

novomesk commented 3 years ago

I converted the WEBP file via imagemagick-7.0.10.46 to PNG and viewed both in Google Chome Beta and they already look different.

I have impression that imagemagick somehow sets gamma 2.2 transfer function instead of sRGB curve.

Try to convert WEBP->PNG by something else, for example save directly from nomacs or from GIMP. Then encode the JXL again (using the new PNG) and try again.

Orum commented 3 years ago

That's rather interesting. Imagemagick's conversion (webp -> png) does show up differently in browsers, but in nomacs they look identical. I'm not sure which is correct, though.

Converting to png via GIMP shows them (webp & png) to be the same in both browsers and nomacs, and then compressing with cjxl produced a jxl that looks the same as the original in nomacs.

My guess is imagemagick puts something in metadata (probably gamma as you suggest), which is respected in all decoders except nomacs, which is why it doesn't appear different there. In any case, it looks like the problem is likely with nomacs as all the others read the file the same way (unless the browsers & cjxl all share the same decoding library, and it's the source of the issue). I'll see if I can dig around a bit more to figure out exactly what's going on.

novomesk commented 3 years ago

It is known fact that color profile support and color management are not perfect in nomacs. There are historical reasons because old Qt didn't have support for that. I suggest you to ask why imagemagick converted WEBP->PNG that way.

Orum commented 3 years ago

Yeah, it's definitely something in ImageMagick, so I'm trying to track down what it is there (though I'm not familar with the source so it's taking some time). In any case, the plugin is working fine when I convert with other utilities.