使用Imagemagick,我想要将一批PNG图像转换为固定高度为1080px和比例宽度。在这里,所谓的“比例”是指:如果原始图像缩小了16.8%以适应1080px,则宽度也需要按比例缩小16.8%。
有没有使用convert而不必事先计算准确几何尺寸(使用identify和一些bash计算骗局)的方法呢?
有没有使用convert而不必事先计算准确几何尺寸(使用identify和一些bash计算骗局)的方法呢?
试试这个:
convert -resize x1080 {from_path} {to_path}
图像几何是一个选项,用于与-resize
一起使用。
xheight Height given, width automagically selected to preserve aspect ratio.
还有一个额外的例子。给调整大小参数一些值,它将自动调整您的图像大小。此外,您可以选择其他参数(如重心中心或裁剪等)。
convert image_example: \
-resize x160 -resize '160x<' -resize 50% \
-gravity center -crop 80x80+0+0 +repage image_example.jpg
干杯