Page 1 of 1

possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-25T11:36:29-07:00
by fmw42
With reference to viewtopic.php?f=1&t=31472

Anthony's example at http://www.imagemagick.org/Usage/quantize/#color_trans, no longer works properly. My result does not agree with his result.

Code: Select all

convert alpha_gradient.png -quantize transparent +dither -colors 15 alpha_colors_15qt.png

Re: possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-25T12:58:57-07:00
by fmw42
This seems to give a similar result to Anthony's.

Code: Select all

convert alpha_gradient.png \
\( -clone 0 -alpha extract \) \
\( -clone 0 -alpha off +dither -colors 15 \) \
-delete 0 +swap -alpha off -compose copy_opacity -composite \
alpha_colors_15qt.png

Re: possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-25T17:07:18-07:00
by magick
It appears to work if you remove the +matte option:

Code: Select all

-> convert xc:red xc:yellow xc:green1 xc:cyan xc:blue \
     +append -filter Cubic -resize 100x100\!  -size 100x100 \
     gradient: -compose CopyAlpha -composite alpha_gradient.png
-> convert alpha_gradient.png -quantize transparent +dither -colors 15 alpha_colors_15qt.png

Re: possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-25T17:33:00-07:00
by fmw42
I just started with his image at http://www.imagemagick.org/Usage/quanti ... adient.png
Image

and applied the command

Code: Select all

convert alpha_gradient.png -quantize transparent +dither -colors 15 alpha_colors_15qt_6979.png
Image


And the result is not correct. It does not match his result at http://www.imagemagick.org/Usage/quanti ... s_15qt.png
Image

Re: possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-27T18:21:10-07:00
by magick
We cannot reproduce the expected results. We tried over 10 different releases of ImageMagick. If you can identify which version of ImageMagick that produces the same alpha_colors_15qt.png as Anthony's web page, let us know. We can then compare that release of ImageMagick with the current release to identify which patch broke the -quantize transparent option.

Re: possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Posted: 2017-02-27T19:37:19-07:00
by fmw42
Anthony's page discussion at http://www.imagemagick.org/Usage/quantize/#color_trans seems to be written at IM 6.2.6 and IM 6.3. I do not have the ability go back that far. I went back to IM 6.7.6.10 and it did not re-create Anthony's example.

I do not think it is a big issue, since I have pointed out a work-around.

My solution was to copy the alpha channel, then process the image with alpha off, then copy the alpha channel back.

Code: Select all

convert alpha_gradient.png \
\( -clone 0 -alpha extract \) \
\( -clone 0 -alpha off +dither -colors 15 \) \
-delete 0 +swap -alpha off -compose copy_opacity -composite \
alpha_colors_15qt.png

But it would be nicer if -colors respected -channel a, so that I could do

Code: Select all

convert alpha_gradient.png -alpha off +dither -colors 15 -alpha on alpha_colors_15qt.png
which does not currently work.