Loading...

STORIES

Image Processing Devilry

ImageMagick is great for batch processing images using the command line.

Here's how to crop multiple images in a folder:

mogrify -crop 402x681+503+215 -path ~/Pictures/MyProject ~/Pictures/MyProject/*.png

This is, if you wanted to crop all PNG images in your MyProject Pictures folder to 402px wide by 681px high, starting at 503px from the left and 215px from the top.

Here's how to overlay multiple images in a folder with an image:

for x in ~/Pictures/MyProject/*.png
do
convert -page +0+0 $x -page +0+0 ~/Pictures/header.png -layers flatten $x
done

If you wanted to overlay all PNG images in your MyProject Pictures folder with an image called header.png, fixed to the top left, in your Pictures folder.