【问题标题】:How to chop selective images using ImageMagick如何使用 ImageMagick 剪切选择性图像
【发布时间】:2017-01-30 12:31:01
【问题描述】:

我想截取专门针对移动设备的屏幕截图。并依次打包成pdf。

#!/bin/sh

desktop_path=./screenshots/desktop/
mobile_path=./screenshots/mobile/
pdf_path=./pdf/

convert ${desktop_path}screenshot-1.png ${desktop_path}screenshot-2.png ${desktop_path}screenshot-3.png ${desktop_path}screenshot-4.png ${desktop_path}screenshot-5.png ${desktop_path}screenshot-6.png ${desktop_path}screenshot-7.png ${desktop_path}screenshot-8.png ${desktop_path}screenshot-9.png ${desktop_path}screenshot-10.png ${desktop_path}screenshot-11.png ${desktop_path}screenshot-12.png ${desktop_path}screenshot-13.png -chop 0x0 ${mobile_path}screenshot-1.png ${mobile_path}screenshot-2.png ${mobile_path}screenshot-3.png ${mobile_path}screenshot-4.png ${mobile_path}screenshot-5.png ${mobile_path}screenshot-6.png ${mobile_path}screenshot-7.png ${mobile_path}screenshot-8.png ${mobile_path}screenshot-9.png ${mobile_path}screenshot-10.png ${mobile_path}screenshot-11.png ${mobile_path}screenshot-12.png ${mobile_path}screenshot-13.png ${mobile_path}screenshot-14.png -chop 0x43 ${pdf_path}packets-temp.pdf

我在这里面临的问题是,即使我为桌面定义了-chop 0x0,但它并没有跳过桌面的斩波,而是像在移动设备上一样为桌面斩波 43px。

【问题讨论】:

    标签: imagemagick


    【解决方案1】:

    如果您不希望对某些图像应用切割,请将您想要切割的图像放在括号中并直接切割它们:

    convert NoChop.png \( ChopMe.png ChopMeToo.png -chop 10x10 \) ... 
    

    或者,先加载你想要切碎的,切碎,然后添加你不想切碎的:

    convert ChopMe.png ChopMeToo.png -chop 10x10 NoChop.png ...
    

    【讨论】:

      【解决方案2】:
      #!/bin/sh
      
      desktop_path=./screenshots/desktop/
      mobile_path=./screenshots/mobile/
      mobile_cropped_path=./screenshots/mobile/cropped/
      pdf_path=./pdf/
      
      mogrify -path ${mobile_cropped_path} -chop 0x43 ${mobile_path}*.png 
      
      convert ${desktop_path}*.png ${mobile_cropped_path}*.png ${pdf_path}packets-temp.pdf
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-04-16
        • 1970-01-01
        • 2013-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-06-19
        • 1970-01-01
        相关资源
        最近更新 更多