本文介绍了如何使用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.

推荐答案

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

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 06:29