Resize Image with Bash Script

You can use bash script to resize images.

Prerequisite :

yum install ImageMagick

Files with .JPG extension , file will be overwritten with new image

for i in *.JPG; do convert $i -resize 10% $(basename $i .JPG).JPG; done

In : $(basename $i .JPG).JPG , the second .JPG is the new extension, you can change it to small .jpg
In Place of -resize 10% you can do -resize 500×500 to resize to pixels
Files with .JPG extension, resize 10% and add -new in the filename.

for i in *.JPG; do convert $i -resize 10% $(basename $i .JPG)-new.JPG; done

You may also like...