如果宽度超过Graphics / Image Magick,如何调整图像大小 [英] How to resize image only if width exceeds with Graphics/Image Magick

查看:159
本文介绍了如果宽度超过Graphics / Image Magick,如何调整图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如下所示: http://www.imagemagick.org/Usage/resize/#缩小选项:

-resize 64x64>

仅在宽度和高度超过64像素时调整大小。但是,如果有效,该怎么做呢:

only resizes if width and height exceeds 64 px. But how about to do something like that if works:

-resize 64>x

-resize 64x'ignores'>

换句话说,如果只有宽度超过此尺寸。
这可能吗?

in other words if only width exceeds this size. Is this possible?

推荐答案

您可以通过使用不太大的高度值轻松实现这一目标:

You can easily achieve that by using an 'unlikely large' height value:

convert  orig.png  -resize '64x10000>'  scaled.png

如果原始PNG的宽度大于64像素(如果其高度大于10  000像素),则会调整原始PNG的大小。但是该命令遇到高于10&n; 000像素的输入的可能性非常低。所以它(几乎)只会遇到宽度值匹配的输入文件。

This will resize the original PNG only if its width was larger than 64 pixels or if its height is larger than 10 000 pixels. But the chance that the command will ever encounter an input that's higher than 10 000 pixels is very low. So it will (almost) only encounter input files where the width value matches.

宽度小于64像素的原始PNG将保持不变(除非它们的高度高于10  000像素......)。

Original PNGs with widths lower than 64 pixels will remain untouched (unless their height is above 10 000 pixels...).

这篇关于如果宽度超过Graphics / Image Magick,如何调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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