【问题标题】:Padd icons with empty space using linux convert utility使用 linux convert 实用程序用空白填充图标
【发布时间】:2012-09-21 14:32:31
【问题描述】:

我有一堆不同大小的PNG图标:

96x96
96x23
96x46
96x80
etc...

如何在 linux convert 实用程序的帮助下填充它们。这样所有图标都具有相同的正方形尺寸,例如96x96

现有图像应居中。像这样(对于大小为5x5的图片):

.....
xxxxx
xxxxx
xxxxx
.....

我使用以下命令来缩放图像。也许,我只是忘记了一些参数?

convert -size 96x96 icon.png -resize 96x96 +profile '*' scaled.png

【问题讨论】:

  • 你有没有同时尝试我的命令?结果如何?
  • 嗨,对不起,现在我无法访问我的 linux 笔记本电脑。我会尽快尝试这个:)

标签: android linux image imagemagick imagemagick-convert


【解决方案1】:

这个应该有帮助:

convert             \
   icon.png         \
  -scale 96x96      \
  -background white \
  -gravity center   \
  -extent 96x96     \
  +profile '*'      \
   scaled.png

【讨论】:

  • 它只是让图像更高。在图像内添加了白色间隙habrastorage.org/storage2/72f/d92/3d4/…
  • 我从来没有遇到过这种情况。能否提供原始 PNG(链接)?
  • @OstapAndrusiv:该命令非常适合我。 ImageMagick 版本 6.7.6-9 2012-05-12 Q16。 GraphicsMagick 版本 1.3.16 2012-06-23 Q8。哪一个是你的?! -- 您的链接图像甚至不是 96x96 的大小,而是 128x256。你确定你没有以某种方式混淆你的输出链接吗?
  • 第一次尝试时,我的 bash 脚本中可能拼写错误。
猜你喜欢
  • 1970-01-01
  • 2022-10-15
  • 1970-01-01
  • 2020-01-07
  • 1970-01-01
  • 1970-01-01
  • 2014-01-12
  • 2014-11-18
  • 2017-12-16
相关资源
最近更新 更多