Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Saturday, July 30, 2016 at 17:00


If the previous post talked about converting, this post gives examples about resizing. ImageMagick has a -resize option to help you resizing images by percentage value. Combining ImageMagick's convert -resize command with bash looping resulting in bulk resizing.

Note: if you want to be precise, just change for example -converted string below with -converted-25%.png or -converted-50%.png or -converted-90%.png respectively.

Resize 25%

for i in *.png; do convert -verbose -resize 25% "$i" "`echo $i | sed 's/.png/-converted.png/g'`"; done

Resize 50%

for i in *.png; do convert -verbose -resize 50% "$i" "`echo $i | sed 's/.png/-converted.png/g'`"; done

Resize 90%

for i in *.png; do convert -verbose -resize 90% "$i" "`echo $i | sed 's/.png/-converted.png/g'`"; done

Resize 120%

for i in *.png; do convert -verbose -resize 120% "$i" "`echo $i | sed 's/.png/-converted.png/g'`"; done

About GNU sed: if you are wondering about sed commands in here, we recommend you to refer to Episode 5 of out GNU sed examples.

Sample Result

 See the left (original) and right (resized) images.