开发者

Preserving the alpha channel when quantizing image in ImageMagick?

I'm currently trying to quantize an image using ImageMagick in PHP, which works fine, except the alpha channe开发者_StackOverflow中文版l isn't preserved. If I iterate through each pixel and count the number of pixels with an alpha value of 0 before quantization, it is correct, but after quantization, nearly all of the image has an alpha value of 0.

Is there a way of preserving this data through the quantization process?


When using the command line imagemagick tools, there is a way to ignore the alpha channel:

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

The option "-quantize transparent" does that. What does the PHP look like?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜