使用 linux 转换实用程序用空白填充图标
-
11-12-2019 - |
题
我有一堆不同大小的 PNG 图标:
96x96
96x23
96x46
96x80
etc...
我怎样才能在linux的帮助下 convert
实用程序,填充它们。这样所有的图标都有相同的方形尺寸,比如说 96x96
.
现有图像应居中。像这样(对于尺寸的图像 5x5
):
.....
xxxxx
xxxxx
xxxxx
.....
我使用以下命令来缩放图像。也许,我只是忘记了一些参数?
convert -size 96x96 icon.png -resize 96x96 +profile '*' scaled.png
解决方案
这个应该有帮助:
convert \
icon.png \
-scale 96x96 \
-background white \
-gravity center \
-extent 96x96 \
+profile '*' \
scaled.png
不隶属于 StackOverflow