Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8
-
None
Description
One of the nice things about QColorSpace is that even when generated from an unsupported ICC profile, it can still provide access to the original profile data via iccProfile(). As I was trying to work around QTBUG-125241, I noticed the JPG reader works as expected, but the PNG reader doesn't provide the original ICC profile if the color space is invalid.
I found a commit to qpnghandler.cpp a few months ago that was presumably to resolve this, but it didn't change these lines at the end of readPngImage:
if (colorSpaceState > Undefined && colorSpace.isValid()) outImage->setColorSpace(colorSpace);
I tested with the 20240425 preview build of Qt 6.8 and confirm that no ICC data is available if it's invalid. The following code was used to test, along with the attached sample image where I intentionally invalidated one of the tag offsets by setting it to 0.
QImage image("/path/to/bumblebee-icc_invalid.png");
qDebug() << image.colorSpace().isValid() << image.colorSpace().iccProfile().length();