我有一个九补丁 png,然后我使用 mogrify -resample
对该 png 重新采样。但似乎 9 补丁边界是错误的。
How can I resample(or something else) that image and keeping the 9-patch border the same as original one.
最佳答案
您可以使用 ImageMagik 做您想做的事情。
基本上,您需要删除现有的 9 补丁标记/边框,重新采样/调整图像大小,然后将 9 补丁标记/边框放回去。
步骤:
- 剪掉旧的 1 像素厚的边框(-crop 命令)
- 重新采样/调整图像大小(-resize 命令)
- 添加透明边框(-matte -bordercolor none -border 1)
- 在新边框上绘制 9 补丁标记(例如 -fill black -draw "line 16,0 17,0"-draw "line 0,16 0,17")
- 保存结果
示例批处理文件行(不执行第 1 步,因此您需要自己弄清楚):
convert -background none foobar.svg -resize 32x32 -matte -bordercolor none -border 1 -fill black -draw "line 16,0 17,0" -draw "line 0,16 0,17" foobar.9.png
关于android - Imagemagick mogrify android 9-patch png,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18385930/