Page 1 of 1

color management documentation

Posted: 2017-11-30T11:30:07-07:00
by fmw42
The page at http://www.imagemagick.org/script/color-management.php is currently inaccurate. It is referring to a time when grayscale and single channels were linear. Currently they are non-linear.

It currently says:

Code: Select all

When separating and recombining channels, with potential intermediate processing, it is important to identify the colorspace used, especially during the recombination. For example,

magick myimage.png -separate myimage_channels_%d.png
magick myimage_channels_*.png -combine myimage2.png
In the above example, the result is darker than the original, because the channels were separate as linear gray and subsequently combined as linear color. In order to return the channels back to sRGB, one must change the colorspace from RGB back to sRGB after the -combine step.

magick myimage.png -separate myimage_channels_%d.png
magick myimage_channels_*.png -combine -colorspace sRGB myimage2.png
If one desires to separate to non-linear grayscale channels, recombine them later, perhaps after some processing, then use the same concept as above for maintaining non-linear grayscale:

magick myimage.png -set colorspace RGB -separate myimage_channels_%d.png
magick myimage_channels_*.png -combine -colorspace RGB -set colorspace sRGB myimage2.png
It should say:

Code: Select all

When separating and recombining channels, with potential intermediate processing, it is important to identify the colorspace used, especially during the recombination. For example,

magick myimage.png -separate myimage_channels_%d.png
magick myimage_channels_*.png -combine myimage2.png
In the above example, the separated channels are non-linear and the default for -combine is to assume non-linear channels. So the result is the same as the input.

If one desires to separate to linear grayscale channels, recombine them later back to non-linear color, perhaps after some processing, then use the same concept as above for maintaining linear grayscale:

magick myimage.png -set colorspace RGB -separate myimage_channels_%d.png
magick myimage_channels_*.png -set colorspace RGB -combine -colorspace sRGB myimage2.png
Furthermore at the top of the page, one needs to distinguish between declaring and converting to linear. So where it currently says:

Code: Select all

To declare that an image is linear RGB rather than sRGB, you can use the set option:

magick myimage.png -set colorspace RGB myRGBimage.png
Afterwards, the verbose information for the output file lists the colorspace as RGB. This only works on image types containing meta data that distinguishes between linear RGB and non-linear sRGB, such as PNG and GIF. Therefore, if the above command is run with a JPG or TIF output format, the verbose information for the colorspace still shows sRGB. In order to properly have the JPG output know that it is linear RGB, include an appropriate color profile.
I would add another line:

Code: Select all

Note that declaring an image as linear is not the same as converting the image to linear. Declaring it is linear only sets the meta data and does not change the pixel data. Whereas converting to linear actually changes the pixel data as described in more detail below.

Re: color management documentation

Posted: 2017-12-01T05:23:33-07:00
by snibgo
Those corrections look good to me.

Re: color management documentation

Posted: 2017-12-20T13:37:01-07:00
by fmw42
Corrections/changes have been made to this page