How to resize multiple images at once

Hi! This post is about a common need for everyone. That's highly probable that, at least once, you needed to resize lots of pictures, either to spare some storage space or just because you needed them to have a specific size for some reason. Below you'll find a script to do it with no effort :) It is based on my previous script for Overlaying a logo in multiple images at once. Once again we'll use the "convert" program from the Imagemagick toolkit.

(Click the photo for better resolution in Picasa Photostream)
The first thing to do is to see the extension of your images. Check if they are in .jpeg, .jpg, .png, .bmp, ... and replace the extension in the 10th line of the script.

Then, you'll have to calculate the resizing factor. Imagine that your images had the size of 640x480 and you wanted to reduce them to 256x192. If you compare the size of both you'll see that the desired size is 40% smaller than the original size (192/480=0.4). Take that value (40%) and replace it in the 11th line. After setting those parameters, you're ready to go.
You can download it here.

And basically that's it! Hope it's useful for you. :)



Did you find this post helpful? Do you wish to contribute to other projects regarding computer science, electronics, robotics or mechatronics that will be posted in this blog? If you wish to do so, you can donate via paypal using the button below. Thanks! :)

Donate

0 Comments:

top