Are -posterize and -colors channel sensitive?

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Are -posterize and -colors channel sensitive?

Post by fmw42 »

IM 6.8.0.8 Q16 Mac OSX Snow Leopard.

I am trying to reduce colors of the L channel in HCL using either -posterize or -colors.

I am getting quite different results from these two commands. I suspect that -posterize and -colors are not channel sensitive. Or there is a bug? Or have I missed something in my commands? If the former, can they both be made channel sensitive, please, when convenient? It is not urgent. Thanks

Image

This works fine:

convert zelda3.png -colorspace HCL -separate +channel \
\( -clone 2 +dither -posterize 6 \) \
-delete 2 -set colorspace HCL -combine -colorspace sRGB show:

This does not match and does not even appear to process correctly if channel sensitive:

convert zelda3.png -colorspace HCL -channel B +dither -posterize 6 +channel -colorspace sRGB show:


Also the same kind of issue with -colors

convert zelda3.png -colorspace HCL -separate +channel \
\( -clone 2 +dither -colors 6 \) \
-delete 2 -set colorspace HCL -combine -colorspace sRGB show:

convert zelda3.png -colorspace HCL -channel B +dither -colors 6 +channel -colorspace sRGB show:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Are -posterize and -colors channel sensitive?

Post by anthony »

Colors is not channel dependant. And Posterize generates a linear array of colors that should then be able to be dithered So perhaps it could be channel dependant at least for the generation of colors.

Of greater concern is that dither does not use all the colors that are given to it, or has than now been fixed?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply