2017-01-30 60 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 ... 
相關問題