Page 1 of 1

-colors question re IM 6.8.9.3 Q16 Mac OSX

Posted: 2014-06-22T19:51:32-07:00
by fmw42
I am curious if -colors is working properly? I get a very poor selection of 4 colors for the following image.

Input:

Image

Code: Select all

convert kdf_black.png +dither -colors 4 -unique-colors -scale 10000% kdf_black_4colors.png
Resulting colors:

Image

Re: -colors question re IM 6.8.9.3 Q16 Mac OSX

Posted: 2014-06-22T22:34:08-07:00
by snibgo
On 6.8.9-0 on Windows 8.1, I get similar or identical colours to you.

When I remove "+dither", I get better colours. I didn't know that "+dither" affected the choice of colours.

Re: -colors question re IM 6.8.9.3 Q16 Mac OSX

Posted: 2014-06-22T23:24:52-07:00
by fmw42
snibgo wrote:On 6.8.9-0 on Windows 8.1, I get similar or identical colours to you.

When I remove "+dither", I get better colours. I didn't know that "+dither" affected the choice of colours.
Yes, you seem to be correct about removing +dither and getting somewhat better colors. But I have to go to 5 colors to get any orange-like color.


convert kdf_black.png +dither -colors 5 -unique-colors -scale 10000% kdf_black_d4_colors.png
Image

convert kdf_black.png +dither -colors 5 -unique-colors -scale 10000% kdf_black_d5_colors.png
Image

convert kdf_black.png -colors 4 -unique-colors -scale 10000% kdf_black_nd4_colors.png
Image

convert kdf_black.png -colors 5 -unique-colors -scale 10000% kdf_black_nd5_colors.png
Image

With regard to dithering, see http://www.imagemagick.org/Usage/quantize/#colors

It does not seem to matter which dithering method I use or the default. They all produce the same results for this case. But it does matter if I add +dither or -dither none.

P.S. I am experimenting with color reduction in order to try to get reasonable seed colors for k-means segmentation script that I am writing.