[Magick-bugs] quantize introduces black
areas (confirmation ofalready posted bug)
Till Oliver Knoll
oliver.knoll at autoform.ch
Tue Sep 11 06:41:53 PDT 2007
Till Oliver Knoll schrieb:
> Peter Pimley schrieb:
>> ...
>>
> The images (QImage from the Qt toolkit) are first converted to 32bit
> before scaling to the proper size (128x128, 96x96, 64x64, ...), saved to
> memory as PNG, put into a Magick Blob and read into a Magick++ Image (I
> am using the C++ interface). Then the colour quantization is done.
I have finally found a way how to convert from QImage to Magick::Image,
so no "PNG to memory buffer" workaround is needed -> this rules out any
possible "PNG format weirdness" :-)
And I found out another interesting issue: it turned out that all the
images which produced "black areas" when quantizing have an alpha
channel value of 254 (instead of the expected 255 - this is yet another
issue, but this time on the QImage/Qt side).
And in combination with a certain value of the colour in the input image
this produces a "black" in the output image.
How to reproduce this bug with an artificial image (similar to the
"scale image", as suggested by Peter):
I did this with the Gimp, I'm not yet such an experienced ImageMagick user:
1. Create a new image, 256x256, 32bit depth
2. Create a colour ramp from pure red to black (the actual colours
probably don't matter; I've taken red instead of blue as suggested
by Peter)
3. Set the alpha chanel value for each pixel to 254 (add layer mask,
fill with (254, 254, 254), apply layer mask)
4. Save image as PNG "alpha254.png"
5. > convert.exe -colors 16 alpha254.png out.png
The out.png contains a black strip about in the middle of the colour scale.
So it really seems that the alpha channel plays an important role in
this issue (and not the size of the image, as suggested before by me).
Hope that gives any (new) hints ;)
Cheers, Oliver
More information about the Magick-bugs
mailing list