Command line batch image cropping tool

is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ?


Solution 1:

In Linux you can use

mogrify -crop {Width}x{Height}+{X}+{Y} +repage image.png

for CLI image manipulation

Solution 2:

Imagemagick's convert does the trick for me (and much more than cropping):

convert -crop +100+10 in.jpg out.jpg

crops 100 pixels off the left border, 10 pixels from the top.

convert -crop -100+0 in.jpg out.jpg

crops 100 pixels off the right, and so on. The Imagemagick website knows more:

http://www.imagemagick.org/Usage/crop/#crop

Solution 3:

Imagemagick is what you want -- tried and true.

Solution 4:

I found nconvert pretty handy so far.

Solution 5:

for f in final/**/*;
do
   convert -crop 950x654+0+660 "$f" "${f%.jpg}".jpg
done

This script loops through all the sub-folders and crops the .jpg files.