Skip to content

Commit

Permalink
Fix reading gamma from PNGs without ICC profile
Browse files Browse the repository at this point in the history
The decoding of PNG_INFO_gAMA to QColorSpace was incorrect, the PNG
gamma is the inverse of the gamma value we use. We revert it
everywhere else, just not here.

Pick-to: 6.2 5.15
Change-Id: Ic0ae1963b2dde3004cac8a6430ddaf99e7096915
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
  • Loading branch information
Allan Sandfeld Jensen committed Jun 11, 2021
1 parent a0524a8 commit de2c3cc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gui/image/qpnghandler.cpp
Expand Up @@ -627,10 +627,10 @@ bool QPngHandlerPrivate::readPngHeader()
}
if (primaries.areValid()) {
colorSpace = QColorSpace(primaries.whitePoint, primaries.redPoint, primaries.greenPoint, primaries.bluePoint,
QColorSpace::TransferFunction::Gamma, fileGamma);
QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
} else {
colorSpace = QColorSpace(QColorSpace::Primaries::SRgb,
QColorSpace::TransferFunction::Gamma, fileGamma);
QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
}
colorSpaceState = GammaChrm;
}
Expand Down

0 comments on commit de2c3cc

Please sign in to comment.