【问题标题】:Imagemagick: Convert to fixed height, proportional widthImagemagick:转换为固定高度,比例宽度
【发布时间】:2011-09-10 01:28:51
【问题描述】:

使用 Imagemagick,我想 convert 将一批 PNG 转换为 1080 像素的固定高度和 成比例的宽度proportional 我的意思是:如果原图缩小 16.8% 到 1080px,宽度也需要缩小 16.8%。

任何使用 convert 的方式,而不必在之前计算精确的几何图形(使用 identify 和一些 bash 计算恶作剧)?

【问题讨论】:

标签: imagemagick image


【解决方案1】:

还有一个例子。给它一些调整大小参数的值,它会自动调整你的图像大小。此外,您还可以选择其他参数(重心或裁剪等)。

  convert image_example: \
          -resize x160 -resize '160x<'   -resize 50% \
          -gravity center  -crop 80x80+0+0 +repage  image_example.jpg

干杯

【讨论】:

    【解决方案2】:

    Image geometry 是一个描述为与-resize 一起使用的选项

    xheight Height given, width automagically selected to preserve aspect ratio.
    

    所以你只需要指定高度

    【讨论】:

      【解决方案3】:

      试试这个:

      convert -resize x1080 {from_path} {to_path}
      

      【讨论】:

        猜你喜欢
        • 2011-11-04
        • 2016-01-15
        • 2011-12-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-09-20
        • 2013-01-13
        相关资源
        最近更新 更多