ImageMagick: Crop a batch of images using convert and a for loop

 
# crop an image
convert image1.png -crop 800x600+0+25 crop_image1.png


# crop an image, and save it on another folder
convert image1.png -crop 800x600+0+25 new_folder/crop_image1.png


# crop a batch of images, and save cropped files as new files
for file in *.png; do convert $file -crop 800x600+0+0 "crop_$file"; done


# crop a batch of images, and save cropped files on another folder
for file in *.png; do convert $file -crop 800x600+0+0 "new_folder/crop_$file"; done


# same as above, but if the file names contain spaces
for file in *.png; do convert "$file" -crop 800x600+0+0 "new_folder/crop_$file"; done

 

Related Snippets

•  ImageMagick: Crop a batch of images using convert and the find command
•  ImageMagick: Rotate a batch of images using convert and a for loop
•  ImageMagick: Rotate a batch of images using convert and the find command