我有一堆不同大小的 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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top