使用Imagemagick,我想convert
一批PNGs的固定高度爲1080px和比例寬度爲。與成比例我的意思是:如果原始圖像縮小16.8%到1080px,寬度也需要縮小16.8%。Imagemagick:轉換爲固定高度,比例寬度
任何使用轉換的方式,而不必計算以前的確切幾何(使用identify
和一些bash計算shenanigans)?
使用Imagemagick,我想convert
一批PNGs的固定高度爲1080px和比例寬度爲。與成比例我的意思是:如果原始圖像縮小16.8%到1080px,寬度也需要縮小16.8%。Imagemagick:轉換爲固定高度,比例寬度
任何使用轉換的方式,而不必計算以前的確切幾何(使用identify
和一些bash計算shenanigans)?
還有一個額外的例子。給它調整大小參數一些值,它會自動調整圖像大小。另外,您可以選擇其他參數(重心或作物等)。
convert image_example: \
-resize x160 -resize '160x<' -resize 50% \
-gravity center -crop 80x80+0+0 +repage image_example.jpg
乾杯
試試這個:
convert -resize x1080 {from_path} {to_path}
這甚至對於相對正常使用(固定寬度),只需將所需寬度的x1080替換爲:580x非常感謝! – 2012-10-26 21:11:08
這應該是被接受的答案。 – futzlarson 2017-04-07 04:20:56
Image geometry是一個選項描述-resize
xheight Height given, width automagically selected to preserve aspect ratio.
使用,因此你只需要指定高度
固定寬度:http://stackoverflow.com/questions/7200909/imagemagick-convert-to-fixed-width-proportional-height – 2017-01-23 00:55:13