-colorspace HSL, HSB, and drawing commands

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
HugoRune
Posts: 90
Joined: 2009-03-11T02:45:12-07:00
Authentication code: 8675309

-colorspace HSL, HSB, and drawing commands

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -colorspace HSL, HSB, and drawing commands

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply