使用Mogrify执行调整大小和填充画布

ako*_*ian 4 resize imagemagick fill mogrify

imagemagick网站在此页面上有一个演示:http://www.imagemagick.org/Usage/resize/#resize

我想在此示例中执行操作:

convert logo: -resize 80x80\> \
          -size 80x80 xc:blue +swap -gravity center  -composite \
          space_resize.jpg
Run Code Online (Sandbox Code Playgroud)

但是对于大量的文件.我认为正确的工具是mogrify,但它不知道+ swap或xc:blue flags.

建议吗?

ako*_*ian 13

我能够通过使用以下内容来完成上述任务:

mogrify -resize 300x300 *.jpg
mogrify -extent 300x300 -gravity Center -fill white *.jpg
Run Code Online (Sandbox Code Playgroud)

这将使图像的最大尺寸为300像素.然后它会将较短尺寸的画布填充到300像素,并用白色填充空白区域.