Page 1 of 1

-colorspace HSL, HSB, and drawing commands

Posted: 2009-07-18T11:56:30-07:00
by HugoRune
when using
-colorspace HSL and HSB, possibly YUV too
together with some other options, like
-fuzz, -opaque, or -trim
weird things happen

Code: Select all

convert colorwheel.png -colorspace HSB -fill white -opaque blue opaque_blue.png
Image

Code: Select all

convert colorwheel.png -colorspace HSL -fuzz 70% -fill white -opaque blue opaque_blue_HSL70.png
Image

Code: Select all

convert colorwheel.png -colorspace HSB -fuzz 70% -fill white -opaque blue opaque_blue_HSB70.png
Image

Code: Select all

convert colorwheel.png -colorspace YUV -fuzz 70% -fill white -opaque blue opaque_blue_YUV70.png
Image

there is also an issue with blur, althought that I can understand: blur does not take into account that the Hue wraps around on red

Code: Select all

convert colorwheel.png -colorspace HSB -blur 10x1000 opaque_blue.png
Image

Re: -colorspace HSL, HSB, and drawing commands

Posted: 2009-07-19T23:15:14-07:00
by anthony
HugoRune wrote:when using
-colorspace HSL and HSB, possibly YUV too
together with some other options, like
-fuzz, -opaque, or -trim
weird things happen
there is also an issue with blur, althought that I can understand: blur does not take into account that the Hue wraps around on red

Code: Select all

convert colorwheel.png -colorspace HSB -blur 10x1000 opaque_blue.png
Image
That is caused by the Hue being a 'modulus' measurement. that is a hue of 255 and 0 are
both almost the same red!

What you see the blur across that red discontinuity going all the way around the rainbow spectrum, rather that reconsing that the two reds are actually almost the same.

just about any operation involving reds in a HSL or HSB colorspace can have this problem,
especially color rotates!



Most of the other problems is that specifying 'blue' as a color specifies it as a RGB, but then the color gets applied to a non-RGB image.

That is 'Blue' in RGB becomes a Saturated Red in HSB or White (in the red spectum) in HSL

This is simular to problems with fully-transparent black ('none') not always being seen as the same thing as fully-transparent red. See Gradients with Transparency
http://www.imagemagick.org/Usage/canvas ... ransparent