batch resize photo on Linux
if you are like me and you have a photo gallery to share your photo to your friends and family and other people, you may have come across the problem of resizing your photos. With a camera taking 4MB photos, I don’t want people to wait 1mn between each photo they look at so I resize them. You could say that I could use picassa or anything else like that but those services and other look-a-like don’t completely suit me.
Anyway, if you want to do that in a couple of secondes on your favourite Linux distro, you need ImageMagick. It’s a very good command line tool that will allow you to script (or just manipulate) your photo. Very useful when you come back from a Safari with 2000 photos :)
you can usually find ImageMagick packaged for every distro but I’ll show you here how to get it for Debian (or any other distro using apt-get …)
sudo apt-get install imagemagick cd ~/photos/myphotos/ mkdir resized cp *.jpg resized cd resized
ImageMagick doesn’t create a new photo smaller but actually resize it so that’s why you should keep a copy of your photos if you want to keep them in the original size.
The command to use is mogrify. It’s always good to have a look at the man page but you basically just need to do as follow to resize a photo -
To resize all the photo with a max height or weight:
mogrify -resize 1920 *.jpg
Or to give a fix size:
mogrify -resize 1024×786! *.jpg
You can do much more with ImageMagick so have a look by yourself!!!