Images processing using ImageMagick (convert)

Submitted by editor on Sat, 06/11/2016 - 23:54
Question

How to convert image using 'convert' ?

Crop images using convert (ImageMagick)

Example (Single file):
convert input.jpg -crop 1300x950+312+72 crop.jpg
convert input.jpg -crop 1300x950-100-50 crop.jpg

Resize images using convert (ImageMagick)

convert -resize 1024x768 *.JPG new_.jpg
convert -resize 25% *.JPG new_.jpg

 

Batch process (bulk processing - shell/batch script)

#Example 1. Crop images
for i in $( ls Renamed/*.jpg); do convert -crop 1300x950+312+72 $i outs/$i; done
#Example 2 Resize images
for i in $( ls ./*.jpg); do convert -resize 1024 $i outs/$i; done
#Example 3. Rename (With aprefix)
for i in $( ls *.jpg); do convert $i FOLDER/PREFIX-$i; done

 

Few use full Examples:

Blur an image (-blur XxX, Ex : 1x1, 1x2, 2x1 .... 0x8) (Help : http://www.imagemagick.org/Usage/blur/)

convert input.png -blur 0x8 output.png
convert input.png -channel RGBA -blur 0x8 ourput.png

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.