解决Android build issue我需要用实心像素替换所有中间 alpha 像素(保留透明背景)。
如何使用 ImageMagick 或其他命令行工具处理树中的所有图像?
图片 bg_all_block.9.png
图片 btn_bg_common_press.9.png
更新:我发现我可以检测是否使用了 alpha,如 Detect Alpha Channel with ImageMagick
其他找到的链接
最佳答案
要从单个图像中删除 alpha channel ,请使用以下命令:
convert input.png -alpha off output.png
要从文件夹内的所有图像中删除 Alpha channel ,请使用
find
首先找到所有PNG文件,然后通过convert
运行'm :find . -name "*.png" -exec convert "{}" -alpha off "{}" \;
请测试您的文件的副本以确保。
...
请参阅下面的对话框,答案基于“我们需要删除不是 255 的 alpha”
convert input.png -channel A -threshold 254 output.png
和批量
mkdir batch
FOR %G IN (*.png) DO convert %G -channel A -threshold 254 batch\%G
关于image-processing - Imagemagick:删除 alpha 分量(用实心像素替换所有中间 alpha 像素),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28937084/