Bulk resizing and reformatting of pictures in an easy and fast way

I went to a BBQ yesterday and took some pictures with my cheap 10 Mpx camera.
This resulted in some nice pictures I’d like to share with friends. (not trough facebook, tough)
The problem of today’s Mpx-hype is that pictures are two to three times bigger than my computer screen.
A .JPG picture of Width: 3648 pixels and Height: 2736 pixels results in a 4.8MB file.
One night of pictures can take several Gigabytes.
The problem of this is when you want to upload them to the internet, or you want to mail them to some friends, they’ll take too much bandwidth or eat your download-limit.
When not using picasa, flickr or facebook or some sort of internet service that is.

So for resizing all the images to something more reasonable, we could use The Gimp with the batch function (included in the gimp-plugin-registry package)
But as these are a lot of large images this would simply take too long as each picture has to be opened/displayed.
Instead I recommend the ImageMagick (set of) program(s) to edit all the pictures at once.

Use the mogrify program to resize images and replace the originals. If you like, you can also change the format (extension) while doing so.
If this is the first time you play around with the ImageMagick programs, you might want to make a backup as you could damage your files irreversible.

Go to the directory where the pictures you want to resize are located.

cd ~/Pictures/TestPictures/
mogrify -resize 40% *.jpg

This will resize all files ending on .jpg to 40% of their original size. Note that the original files are replaced!

Now, if you want to convert all the .jpg files to .png’s as well, you can do this by using mogrify’s -format option like this:

mogrify -format png *.jpg

You can even do these two steps in one single command:

mogrify -resize 40% *.jpg | mogrify -format png *.jpg

So now you can relax and lay back till it’s done. 🙂