Vidar
26 June 2009
Batch resizing images
Today I needed to send a bunch of images to my friend, but each of them were over 2MB in size and wouldn’t fit in one email. Here is how I resized all the images in a directory from the command line using the convert command shipped with the image manipulation library Imagemagick
for i in *; do convert $i -resize 50% ${i/\.*/}.jpg; done
You can play with the options, just check the man page for convert. Change the .jpg with another extension to convert to another format simultaneously.
« Back to posts Write a new comment