[3 gamma=1 Gray imgs -combine: Will patch set colorspc RGB? -edit] round-trip error (-separate or -combine change gamma)
Posted: 2017-08-09T16:59:19-07:00
When the colorspace is linear RGB with gamma=1, the operators -separate and -combine ignore all of that and mark their output as nonlinear (colorspace gray for -separate or colorspace sRGB for -combine) with gamma~0.4545...
In the following, -separate is changing the marked gamma from 1 to 0.454545 in each of the three resulting identical grayscale images, without changing the data values (back) to have mean 25864.7 as they should (and originally did) when gamma=0.454545. So the resulting image(s) will be too dark.
In the following I work around the -separate problem by explicitly setting the gamma back to 1.
But then I do a -combine and this changes it to 0.45455 when combining the three identical linear single-channel images.
So again the result is too dark, this time due to -combine.
Since we only have one single-channel colorspace ("gray" which seems usually to be treated by default as nonlinear in the sRGB sense), the only way to preserve this information is by preserving gamma.
I'm using IM7.0.6-2 Q16 HDRI x64 (Windows 7).
In the following, -separate is changing the marked gamma from 1 to 0.454545 in each of the three resulting identical grayscale images, without changing the data values (back) to have mean 25864.7 as they should (and originally did) when gamma=0.454545. So the resulting image(s) will be too dark.
Code: Select all
$ magick rose: -colorspace gray -write rosegray.miff -colorspace RGB -write rosegrayRGB.miff -separate rosegrayRGBseparated.miff
$ magick identify -format '%M %[colorspace] %[gamma] %[mean]\n' rosegray.miff rosegrayRGB.miff rosegrayRGBseparated.miff
rosegray.miff Gray 0.454545 25864.7
rosegrayRGB.miff RGB 1 11130.8
rosegrayRGBseparated.miff Gray 0.454545 11130.8
rosegrayRGBseparated.miff Gray 0.454545 11130.8
rosegrayRGBseparated.miff Gray 0.454545 11130.8
But then I do a -combine and this changes it to 0.45455 when combining the three identical linear single-channel images.
So again the result is too dark, this time due to -combine.
Code: Select all
$ magick rosegrayRGBseparated.miff -set gamma 1 -write roselinear.miff -combine roselinearcombined.miff
$ magick identify -format '%M %[colorspace] %[gamma] %[mean]\n' roselinear.miff roselinearcombined.miff
roselinear.miff Gray 1 11130.8
roselinear.miff Gray 1 11130.8
roselinear.miff Gray 1 11130.8
roselinearcombined.miff sRGB 0.454545 11130.8
I'm using IM7.0.6-2 Q16 HDRI x64 (Windows 7).