Page 1 of 1

ImageMagick Color Management

Posted: 2012-06-23T05:35:51-07:00
by magick
ImageMagick always supported color profiles, however, for images without a profile or a declaration of colorspace, ImageMagick assumed linear RGB. With support of the sRGB colorspace in practically every camera made now-a-days, ImageMagick was modified as of version 6.7.7-8 to assume sRGB unless otherwise specified by a color profile or colorspace (e.g. CMYK). In addition, for many of the image formats we assume grayscale is linear. Most image processing algorithms assume a linear colorspace, therefore we recommend you remove the gamma function before certain image processing algorithms are applied. For example,
  • convert myimage.jpg -colorspace rgb -resize 200% -colorspace sRGB mybigimage.jpg
To declare an image is linear RGB rather than sRGB, you can use the set option:
  • convert myimage.jpg -set colorspace RGB myRGBimage.jpg
Post any questions or concerns about these changes to the user or developers forum.

Thanks to Anthony and Fred for their invaluable help in ensuring sRGB support within ImageMagick worked properly. And thanks to for the correct formulations for converting linear RGB to sRGB and back.

Re: ImageMagick Color Management

Posted: 2012-09-20T17:43:07-07:00
by anthony
For examples of doing resizes using linear-RGB colorspace see
IM Examples, Resizing with Colorspace Correction ... colorspace

The page also goes on to the many filters, options and techniques you can use to improve resizing.

Re: ImageMagick Color Management

Posted: 2013-08-20T15:15:36-07:00
by fmw42
After IM, the -set colorspace RGB, is no longer needed when converting to other colorspaces channels (nor for -colorspace gray).

-colorspace gray is also now equivalent to rec709luma rather than rec601luma to be more consistent with sRGB standards

Re: ImageMagick Color Management

Posted: 2013-10-25T18:26:01-07:00
by fmw42
Starting with IM all grayscale colors and grayscale gradients are now non-linear (by default) with gamma=0.4545 rather than the ones with gray(...) being linear with gamma=1 (which was the case from about IM

So the following formats that used to be linear (gamma=1) are now non-linear (gamma=0.4545)


Named grayscale or gradient with named grayscale colors are still non-linear with gamma=0.4545

The only exceptions seems to be in IM where gamma=1 (linear) for both gray(...) and gray(...) gradients
and in IM where only the gray(...) gradients still show gamma=1 (linear), but simple gray(...) colors have gamma=0.4545 (non-linear)

To create linear gray scale colors one can do either:

1) use icc-color(rgb,xx,xx,xx) to get a linear gray

NOTE: that is different from icc-color(srgb,xx,xx,xx) with produces a non-linear gray



convert -size 100x100 xc:"icc-color(rgb,128,128,128)" -format "%[gamma]\n" info:

2) use xc:gray -intensity rec709luminance -colorspace gray


convert -size 100x100 xc:gray -intensity rec709luminance -colorspace gray -format "%[gamma]\n" info: