Linux Hack – How to Batch Image Resize!

Well, one of the worst things you can encounter is to individually resize hundreds of images for a future blog post.

I am not sure if Windows or Macs have free software to do this but if you have access to a Linux computer like me, you can get stuff done much faster using Image Magick, a free open-source image auto-resizer also used on many web-platform programs.

I assuming that you have installed Ubuntu Gutsy:

sudo apt-get install imagemagick

After ImageMagick installation, you can use mogrify. For example, I have a folder called “holidays” locate in “/home/user/photos/“. I have to change my path, make a thumbs folder and copy original images on “thumbs folder”. After that I can start image resizing process:

cd /home/user/photos/holidays
mkdir thumbs
cp /home/user/photos/holidays/* /home/user/photos/holidays/thumbs/
cd thumbs

mogrify -resize 640 *.jpg

Now I can see on “/home/user/photos/holidays/thumbs/” every my image file resized to 640 of width. If you want force resizing to a particulare size without mantaining original aspect ratio you could change mogrify options:

mogrify -resize 640×480! *.jpg

Good Job Man! I hope this howto will be useful for you.

via smokinglinux

2 Responses to Linux Hack – How to Batch Image Resize!

  1. Windows XP has an “Image Resizer” powertool that allows one to resize multiple images at once.

  2. John says:

    I LOVE THIS POST. Clear and great CLI usage!

Leave a Reply

Your email address will not be published.

Related News and Resources