On Wed, 30 Dec 2015, Caio S. Souza wrote:
Hi! I posted this question on the QT forum and recommended me to ask it in the mailing list. I am developing an image manipulation app that must be color managed. I have a pixel buffer with the colors already converted to the display profile. I researched a lot and found that QImage works with colors in a linear color space, so everything should be ok.
Are you sure about that? The pixels in a QImage are completely unmanaged, as far as I know. When you load a gamma corrects png file into a QImage, for instance, the gamma correction isn't converted to linear gamma. Maybe QPainter internally converts to linear gamma before blending, or QImage to linear gamma before scaling -- like discussed in https://bugreports.qt.io/browse/QTBUG-45209, but that would assume that the data in the QImage itself is gamma corrected sRGB, which need not be the case. Actually, I'm pretty sure that loading an icc tagged png or jpeg into a QImage doesn't do any conversion to sRGB. (And sRGB itself is a weird thing: http://ninedegreesbelow.com/ discusses sRGB a lot, and it's not just one thing.)
But if I create a pixmap using QPixmap::fromImage, does QT apply any color transformation before displaying the image? If it does, what is the recommended way to display this image without modifications?
If you need color management for an image manipulation application, I would (well, I am, since I'm working on exactly that kind of application) not use QImage to store the image data. I use lcms2 or opencolorio to convert from the working colorspace to the display colorspace and then use either opengl or qimage/qpainter to paint the pixels on the widget. When converting my display corrected pixels to a qimage for the cpu-based canvas, nothing weirds happen, Qt isn't doing anything to my pixels. You can check out the source code here: https://phabricator.kde.org/diffusion/KRITA/. -- Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest