我怎么能用ImageMagick做FloydSteinbergAlpha抖动?

时间:2014-07-14 15:16:38

标签: imagemagick

我刚将所有图像更改为RGBA4444,使用TexturePacker进行spritesheets,将ImageMagick更改为单个图像。

有可能用ImageMagick进行FloydSteinbergAlpha dithing吗?我只能找到FloydSteinberg的抖动(即没有alpha)。

我的选择是-depth 4 -d FloydSteinberg

1 个答案:

答案 0 :(得分:3)

在删除颜色计数时会应用-dither以及像素深度(请参阅Quantization Colors)。

convert source.png -colors 64 -dither None out.png
convert source.png -colors 64 -dither FloydSteinberg out.png
convert source.png -colors 64 -dither Riemersma out.png

64 color dither

对于像素深度为4,我们可以假设为2^4 = 16

convert source.png -depth 4 -colors 16 -dither None out.png
convert source.png -depth 4 -colors 16 -dither FloydSteinberg out.png
convert source.png -depth 4 -colors 16 -dither Riemersma out.png

4-bit depth with dither

修改

要在抖动中包含alpha,请将-quantize设置为透明

convert source.png \
        -quantize transparent \
        -dither FloydSteinberg \
        -depth 4 -colors 16 \
        out.png

dither with transparent