qView icon indicating copy to clipboard operation
qView copied to clipboard

Color profile problems? Image too saturated in qView

Open lorenzofanchi opened this issue 5 years ago • 23 comments

Hi, I noticed my images are always more saturated in qView, when compared to Adobe Photoshop, Preview and Xee, to name a few. The latter three all show the image the same way, only qView is the exception.

Xee on the left, qView on the right: Screenshot 2020-04-10 at 14 39 54

Here's the color test image: color-test

lorenzofanchi avatar Apr 10 '20 12:04 lorenzofanchi

Yes, color profiles seems ignored on qView. Two tests that must looks the same on any screen (sRGB or not): Sand-Dunes-ProPhoto-RGB Sand-Dunes-sRGB

IpsmLorem avatar Apr 10 '20 13:04 IpsmLorem

Qt does not support system color profiles. It assumes sRGB under all conditions (The colors will match if your display is set to an sRGB color profile).

relevant qt bug (from 2009!): https://bugreports.qt.io/browse/QTBUG-6582?focusedCommentId=368320&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel

Other Qt projects have adopted Little CMS to support color profiles. I try to avoid dependencies as much as possible for performance reasons, but this might be an exception in the future due to just how critical it is to user experience.

jurplel avatar Apr 10 '20 16:04 jurplel

My 2 cents: I would love to use qView to look at my (Adobe RGB) exported photos. Would not want to go back to Xee now ;)

lorenzofanchi avatar Apr 10 '20 17:04 lorenzofanchi

Take a look into QColorSpace which was introduced with Qt 5.14 https://doc.qt.io/qt-5/qcolorspace.html

QColorSpace provides access to creating several predefined color spaces and can generate QColorTransforms for converting colors from one color space to another. QColorSpace can also represent color spaces defined by ICC profiles or embedded in images, that do not otherwise fit the predefined color spaces.

Constant Value Description
QColorSpace::SRgb 1 The sRGB color space, which Qt operates in by default. It is a close approximation of how most classic monitors operate, and a mode most software and hardware support. ICC registration of sRGB.
QColorSpace::SRgbLinear 2 The sRGB color space with linear gamma. Useful for gamma-corrected blending.
QColorSpace::AdobeRgb 3 The Adobe RGB color space is a classic wide-gamut color space, using a gamma of 2.2. ICC registration of Adobe RGB (1998)
QColorSpace::DisplayP3 4 A color-space using the primaries of DCI-P3, but with the whitepoint and transfer function of sRGB. Common in modern wide-gamut screens. ICC registration of DCI-P3
QColorSpace::ProPhotoRgb 5 The Pro Photo RGB color space, also known as ROMM RGB is a very wide gamut color space. ICC registration of ROMM RGB

moowgle avatar Oct 28 '20 23:10 moowgle

Well looks like we're in business. I'll see what I'm able to do for 5.0.

jurplel avatar Oct 29 '20 01:10 jurplel

Does that mean qView will be able to display CMYK images correctly too? Currently they are really off, which is understandable if it's trying to force them into sRGB.

Nikoichu avatar Nov 20 '20 09:11 Nikoichu

I'm not sure, I have a lot of experimenting to do with this.

jurplel avatar Nov 24 '20 01:11 jurplel

https://littlecms.com/blog/2020/12/09/using-lcms2-on-qt/

novomesk avatar May 11 '21 13:05 novomesk

Any progress on this?

lorenzofanchi avatar Dec 04 '21 16:12 lorenzofanchi

I have not looked into it yet. I have been busy with school but I am going to try to sift through some issues over winter break.

jurplel avatar Dec 12 '21 03:12 jurplel

I was a Xee3 user but it is generally broken on modern macOS and Apple SoCs. Found qView but noticed this issue immediately and was pretty baffled since the bulk of Apple devices since 2015 have used the Display P3 gamut, but realized since it's Qt that it doesn't benefit from ColorSync and would require integrating littleCMS which can be non-trivial especially when you get into things like moving the window between displays with different device profiles.

Ended up building a photo viewer with AppKit for myself that basically behaves the way Xee3 did. Wanted to wish you folks the best with adopting color management in your app though. Seems like a great app in all other respects.

nexusCFX avatar Dec 20 '21 22:12 nexusCFX

@nexusCFX Is your viewer open source? I would love to try it out!

lorenzofanchi avatar Dec 21 '21 09:12 lorenzofanchi

@nexusCFX Is your viewer open source? I would love to try it out!

Due to my employment and the nature of what the app is, I don't believe I can release it as an open source project at this time, there would be some troublesome approvals and evaluations needed which I don't care to do for such a small project. That is also why I cannot offer assistance in doing the littleCMS integration for qView despite my interest in doing so.

nexusCFX avatar Dec 23 '21 01:12 nexusCFX

@nexusCFX Is your viewer open source? I would love to try it out!

Due to my employment and the nature of what the app is, I don't believe I can release it as an open source project at this time, there would be some troublesome approvals and evaluations needed which I don't care to do for such a small project. That is also why I cannot offer assistance in doing the littleCMS integration for qView despite my interest in doing so.

I am considering trying out imagemagick for image loading--it would simplify deployment significantly, probably have better performance, and support many more formats. Do you know if it would solve the color profile problem?

jurplel avatar Dec 23 '21 01:12 jurplel

@nexusCFX Let your bosses know that they suck!

Hrxn avatar Dec 24 '21 15:12 Hrxn

@jurplel If you don't want new dependency (like lcms2), use just this Qt function prior displaying a picture: void QImage::convertToColorSpace(const QColorSpace &colorSpace)

Qt doesn't support all ICC profiles but it works for majority of common cases.

In any case, you need to implent getting monitor's ICC profile on every platform and/or let the user to select, whether to render images as sRGB or P3 (in case detection of the monitor's profile failed).

There could be also option not to use color conversion for quick performance.

novomesk avatar Dec 24 '21 20:12 novomesk

Would this work with image's embedded color profiles?

jurplel avatar Dec 27 '21 03:12 jurplel

Yes, it is exactly for that purpose.

It will work for all Qt-supported color profiles, where QImage::colorSpace().isValid() == true

Some old, third party Qt plug-ins do not load color profile, because QColorSpace is available since Qt 5.14

novomesk avatar Dec 27 '21 05:12 novomesk

Nice, I will give it a shot. Thanks for the info!

jurplel avatar Dec 27 '21 05:12 jurplel

I am sending you another test images:

https://webkit.org/blog-files/color-gamut/Flowers-ProPhoto.jpg

https://webkit.org/blog-files/color-gamut/Flowers-sRGB.jpg

Now they look different in qView, but after colorspace conversion they should look almost identical.

novomesk avatar Dec 27 '21 10:12 novomesk

Examples how to auto-detect monitor's ICC profile:

on Windows: WcsGetDefaultColorProfile https://gitlab.gnome.org/GNOME/gimp/-/blob/master/libgimpwidgets/gimpwidgetsutils.c#L675

on Linux/X11: XGetWindowProperty https://invent.kde.org/graphics/gwenview/-/blob/master/lib/cms/cmsprofile.cpp#L247

Usage of ICC profile in Qt: QColorSpace::fromIccProfile

novomesk avatar Dec 27 '21 15:12 novomesk

Darn, more platform specific code :'(

jurplel avatar Dec 27 '21 18:12 jurplel

Any progress on this? This is an important issue.

Andreas0602 avatar Aug 02 '22 09:08 Andreas0602

In any case, you need to implement getting monitor's ICC profile on every platform

@novomesk Do you know if Little CMS helps with this part? If I understand correctly, qView would still need its own platform-specific monitor ICC profile detection - Little CMS just handles the color conversion part right?

jdpurcell avatar Jan 15 '23 22:01 jdpurcell

lcms2 can do the conversion, but profile detection needs specific code for each platform.

novomesk avatar Jan 15 '23 22:01 novomesk

I got Windows/macOS ICC profile detection working in #521. Just using QColorSpace::fromIccProfile / QImage::convertToColorSpace, not Little CMS.

jdpurcell avatar Jan 15 '23 23:01 jdpurcell

@jdpurcell that's awesome to hear! chance of a release any time soon?

lorenzofanchi avatar Jan 16 '23 08:01 lorenzofanchi

@lorenzofanchi I don't know about release plans but the automated (aka "nightly") builds are a good option. The most recent build for #521 is located here if you'd like to try it. At the bottom of that page, the Artifacts section has download links for each platform (they are only links when signed into GitHub by the way, otherwise they are just plain text).

Note that color space conversion is not yet enabled by default; go to Options -> Image tab to configure it.

jdpurcell avatar Jan 16 '23 14:01 jdpurcell