pqiv icon indicating copy to clipboard operation
pqiv copied to clipboard

Proper color management with ICC profiles

Open T-3B opened this issue 1 year ago • 3 comments
trafficstars

It appears that pqiv is ignoring color profiles (ICC).

For example this comparison: image Left is the PNG version, and right is a JPG with XYB ICC. The right part of the screenshot should be identical to the left if there was a proper color management.

Here is the XYB JPG: xyb

Note that mpv does output the correct colors because it fetches the ICC profile (and MPV uses FFmpeg as pqiv does). Browsers also support ICC profiles.

I really hope this will be implemented in pqiv. Thank you very much for this minimalist and keyboard-oriented image viewer, I love it :)

T-3B avatar Mar 24 '24 20:03 T-3B

pqiv uses GTK's own GdkPixbuf for rendering standard file formats, and it looks like it doesn't really support this:

https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/104

Do any Gnome default viewers get this right for you? If yes I could take a look at how they do this.

Does disabling the gdkpixbuf backend fix this for you?

phillipberndt avatar Mar 25 '24 07:03 phillipberndt

GdkPixbuf supports ICC profiles. An example of Gnome viewer supporting this JPG file: "Eye of Gnome"

Does disabling the gdkpixbuf backend fix this for you? No, as well as disabling everything except wand (ImageMagick)

A "friend of mine" explained me:

the ICC profile is a base64-encoded null-terminated ASCII string icc-profile option key used in gdk_pixbuf_get_option

you can call gdk_pixbuf_get_option("icc-profile") which returns a gchar * string, and then you can use g_base64_decode to get the actual ICC profile buffer which can be fed to lcms2 or something of that form

I don't know many things about all that stuff (sorry), but it feels like it is possible to render this JPG correctly in pqiv. Thank you for your fast answer!

T-3B avatar Mar 25 '24 08:03 T-3B

Don't hesitate to say if the information of the previous message was enough (or not), or if I should redirect you to actual code of a Gnome image viewer supporting ICC profiles. 🙂

T-3B avatar Apr 03 '24 20:04 T-3B