From de2c3ccd49cb89e0c6912da3b03705a36ef03946 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 9 Jun 2021 15:51:54 +0200 Subject: [PATCH] Fix reading gamma from PNGs without ICC profile 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 --- src/gui/image/qpnghandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 9943e7261a..c013a06813 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -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; }