Using convert command to change size of a picture or many
convert -resize 50% one.jpg two.jpg
convert -size 120×120 one.jpg -resize 120×120 out.jpg
convert -size 120×120 one.jpg -resize 120×120 out.jpg
And we can create some script to change all the picture in a directory
#nano scriptchangeimage
#!/bin/bash
INPUT=$1
for i in *.JPG; do
if [ -e “$i”]; then
file=’basename “$i” .JPG’
convert “$i” -resize “$1” “$file.resize.JPG”
fi
done
INPUT=$1
for i in *.JPG; do
if [ -e “$i”]; then
file=’basename “$i” .JPG’
convert “$i” -resize “$1” “$file.resize.JPG”
fi
done
change the file property into execute mode
#chmod 755 scriptchangeimage
Use it like this
#./scriptchangeimage 50%
And now all picture went 50% smaller.