如何使用Image Magick批量将所有图像调整为sqares? [英] How do I batch resize all images to sqares with Image Magick?

查看:158
本文介绍了如何使用Image Magick批量将所有图像调整为sqares?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

行。我有一个水平图像,比如2000 x 300.我想要覆盖那个图像并创建一个2000 x 2000的新图像,旧图像中心位于中间和垂直方向,周围有白色空间。我也希望批量使用不同大小的许多不同图像。在此先感谢。

OK. I have a horizontal image, let's say 2000 x 300. I want to overwrite that image and create a new one that is 2000 x 2000 with the old image center in the middle and vertically, with white space around it. I also want to do this in batch with many different images of different sizes. Thanks in advance.

推荐答案

使用 -resize 将图片大小调整为2000x2000, -background 将背景设置为白色, -gravity 将原始图像置于画布上,并 -extent 调整画布本身的大小(如果图像最初不是正方形,则使图像位于中心)。

Use -resize to resize the image to 2000x2000, -background to set the background to white, -gravity to center the original image on the canvas, and -extent to resize the canvas itself (to cause the image to sit in the centre if it wasn't square originally).

convert [imagename] -resize 2000x2000 -background white \
                    -gravity center -extent 2000x2000 [imagename]

这篇关于如何使用Image Magick批量将所有图像调整为sqares?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆