Page 1 of 1

Not like in the docs: Gradients in other Colorspaces

Posted: 2018-04-17T08:18:41-07:00
by elmimmo
When running any of the two example commands in Gradients in other Colorspaces to create a full rainbow gradient,

Code: Select all

convert -size 30x600 gradient:'#FFF-#0FF' -rotate 90 \
-set colorspace HSB -colorspace RGB \
gradient_rainbow_2.jpg
the result is different depending on whether I output to JPEG or to TIFF. If JPEG, the result is identical to that of the docs; if TIFF, the output is 16 bit and the gradient is not linear: red, green and blue areas are thicker than the colors in between them (yellow, cyan, magenta). Even if I downgrade the bitdepth to 8 bit by appending `-depth 8` either as the first option or the last before the output name, the result is visually identical.

Code: Select all

convert -depth 8 -size 30x600 gradient:'#FFF-#0FF' -rotate 90 \
-set colorspace HSB -colorspace RGB \
gradient_rainbow_2.tif

Code: Select all

convert -size 30x600 gradient:'#FFF-#0FF' -rotate 90 \
-set colorspace HSB -colorspace RGB -depth 8 \
gradient_rainbow_2.tif
I am using this version:

Code: Select all

$ magick -version
Version: ImageMagick 7.0.7-28 Q16 x86_64 2018-03-25 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

Re: Not like in the docs: Gradients in other Colorspaces

Posted: 2018-04-17T08:37:26-07:00
by snibgo
That documentation was written when IM was different, and it has not been updated.

I suggest you use the "sRGB" colorspace, not "RGB" (which is the linear version of sRGB).

What you see with RGB colorpsace will depend on whether your viewing software recognises linear RGB and converts it to sRGB, or whether it assumes (incorrectly) the image is sRGB.

Re: Not like in the docs: Gradients in other Colorspaces

Posted: 2018-04-17T08:44:46-07:00
by elmimmo
`-colorspace sRGB` instead of `-colorspace RGB` did indeed fix it. Thanks!