possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

possible bug -quantize transparent IM 6.9.7.9 Q16 Mac OSX SnowLeopard

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
Post Reply