2017-01-30 56 views
0

我想截断特定于移动设备的截图图像。并将它们按顺序捆绑成pdf。如何使用ImageMagick对选择图像进行切割

#!/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就像在移动的印章。

+0

难道我的回答整理一下你的问题吗?如果是这样,请考虑接受它作为您的答案 - 通过点击投票计数旁边的空心绿色勾号/复选标记。如果没有,请说出什么不起作用,以便我或其他人可以进一步帮助您。谢谢。 http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 –

回答

0
#!/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 
1

如果您不希望应用到一些图像的印章,把你在括号希望切碎的那些,只是砍他们:

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

或者加载你想先砍伤的,他们砍,然后添加你不想砍伤的:

convert ChopMe.png ChopMeToo.png -chop 10x10 NoChop.png ... 
相关问题