[Development] QT5 and color management

Morten Sorvig Morten.Sorvig at qt.io
Mon Aug 29 15:16:16 CEST 2016


> On 29 Aug 2016, at 10:20, Anders Torger <torger at ludd.ltu.se> wrote:
> 
> 
> Hello,
> 
> The color management capabilities of QT for displaying images is quite 
> hard to figure out. I've searched the internet and you get very few 
> hits often pointing to discussions several years old. So I think it's 
> appropriate to start a new thread to get the latest.
> 
> I'm new to QT, but I'm not new to color management and ICC profiles. 
> I've worked a bit with GTK and RawTherapee project so I know how color 
> management is handled there in Windows / Linux and OS X.
> 
> What you typically do in a cross-platform scenario is that you figure 
> out which ICC profile the display has in a platform-specific way (if 
> you have multi-head you just have to choose one, haven't seen anyone 
> handle a window which is displayed on two screens simultaneously), and 
> then you use LittleCMS or other third-party library to convert your 
> RGB data yourself to an output that matches the display, and then you 
> just put that raw data to the screen using the GUI toolkit. In other 
> words, the GUI toolkit doesn't do any color conversions, but just 
> delivers the raw pixel values to the display.
> 
> This is how you do it in GTK. With GTK there is as far as I know a 
> problem on Mac OS X, where GTK is not low-level enough; Mac OS X APIs 
> (Quartz?) will do the display conversion always so you can only output 
> sRGB(?). I've not worked too much with OS X so I'm not 100% sure how it 
> works there or if there is a work-around to get larger color space than 
> sRGB. If anyone happens to know that too, I'm all ears.

We’ve researched a bit into the OS X side of this, see QTBUG-47660. Input
from application developers is very welcome here - I’d like to make sure
what we implement is actually usable in practice.

If you don’t want to use OpenGL then we’re looking at supporting two modes:

* The application outputs sRGB/linear sRGB to Qt. Qt will configure the
  native view accordingly, color conversion to the display color space 
  is done by the OS.

* The application gets the ICC profile for the display and outputs per-
  display correct colors to Qt. Qt configures the native view to use the 
  display profile. There is no color space conversion outside application code.

There is currently no API available to support this; the first iteration
would probably be a a mac-spesifc API.

Recently Apple introduced the "extended linear sRGB” color space (with
support for component values below 0.0 and above 1.0), specifically for
wide-gamut displays. I think we need floating-point support in QImage
to make use of this format.

Morten



More information about the Development mailing list