ImageMagick 更改宽高比而不缩放图像
我有大量图像,可以是我需要的任何尺寸,使其具有相同的长宽比(基本上是正方形)。因此,如果一张图像的分辨率为 100x300,则输出应为 300x300。我不想要的是图像以任何方式缩放或拉伸。我只想将背景颜色(白色)应用于图像的两侧,然后将原始图像居中(垂直或水平取决于原始长宽比)。
我已经尝试过几种不同的转换命令,但我还没有找到神奇的命令 - 它们要么扭曲图像以达到纵横比,要么将图像缩放到正确的较大尺寸,但没有纵横比我正在寻找的比率。
提前致谢
I have a large number of images that can be any dimension that I need make into the same aspect ratio (basically square). So if one image is 100x300 the output should be 300x300. What I don't want is the image scaled or stretched in any way. I just want a background color (white) applied to the sides of the image, then the original image centered (either vertically or horizontally depending on the original aspect ratio).
I've played around with a couple different convert commands, but I have not found the magic one yet - they all either distort the image to reach the aspect ratio, or scale the image to the correct larger dimension, but do not have the aspect ratio I was looking for.
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅http://www.imagemagick.org/Usage/crop/#extent
See http://www.imagemagick.org/Usage/crop/#extent