[glennrp fixd IM7 to git] reading linear png (GAMA=1) sets sRGB (nonlinear colorspace) but should set RGB (linear) instd
Posted: 2017-07-29T16:29:22-07:00
By request, I'm submitting this simple issue in reading linear png files, separately from another thread (where we were mostly discussing the wisdom of writing linear png files to begin with under certain circumstances).
The problem is that on reading a linear png, i.e. a png file with a GAMA=1 chunk (whether the file was created by IM or not), IM is setting the colorspace incorrectly as sRGB (a nonlinear colorspace) even though it is also marking the image (correctly) as gamma=1. Among other things, this leads to cumulative colorspace transformation errors after round-trip conversions. I've only tested it with linear 16-bit png files, but it's likely that it's the same issue when reading a linear 8-bit png as well.
The correct thing to do when gamma=1 in a png being read into IM would be to mark the image as being in RGB (linear) colorspace, not sRGB.
(I'm using ImageMagick 7.0.6-2 Q16 x64 2017-07-22.)
The problem is that on reading a linear png, i.e. a png file with a GAMA=1 chunk (whether the file was created by IM or not), IM is setting the colorspace incorrectly as sRGB (a nonlinear colorspace) even though it is also marking the image (correctly) as gamma=1. Among other things, this leads to cumulative colorspace transformation errors after round-trip conversions. I've only tested it with linear 16-bit png files, but it's likely that it's the same issue when reading a linear 8-bit png as well.
The correct thing to do when gamma=1 in a png being read into IM would be to mark the image as being in RGB (linear) colorspace, not sRGB.
(I'm using ImageMagick 7.0.6-2 Q16 x64 2017-07-22.)