Reputation: 4568
I have a few large pngs. I'm cropping them with convert and then creating a pdf from them.
find . -name 'test_*.png' -exec convert -crop 600x1000+400+50 {} {} \; -exec echo {} \;
convert `ls -v test_*.png` test.pdf
It all works well enough. The images are cropped fine. The pdf is generally fine. The problem is that each page of the resulting pdf has white padding which matches the pre-cropped image size.
Am I missing a step to reset the image size metadata or something?
Upvotes: 0
Views: 85
Reputation: 207425
I think this might be better:
find . -name 'test_*.png' -print -exec convert {} -crop 600x1000+400+50 +repage {} \;
convert test_*.png test.pdf
I think -print
amounts more succinctly to -exec echo {} \;
The preferred order of ImageMagick commands is:
convert input.png ... output.png
The +repage
makes an image forget its previous canvas size.
Upvotes: 2