HOWTO batch/mass image resize
September 22, 2007
so you’ve got 800 .JPGs in one folder, and you need to resize all of them. you would definitely not want to open every each one in GIMP and resize it one by one. here’s a script that would make this task easier:
but first you need imagemagick to get this to work, so:
sudo apt-get install imagemagick
and here’s the script:
#!/bin/bash
for i in `ls *.jpg`;
do
convert $i -resize 800×600 $i
done
save this in a file in the same folder as your target images, then, make sure it is executable in Properties > Permissions, then run it in the terminal using ./filename
it will take some time to resize a hundred images, be patient.
note: the file extension is case sensitive, almost everything in linux is case-sensitive, well it actually should be.











November 2, 2007 at 11:07 pm
Probably this is now much easier with phatch which can add some actions to the resizing such as drop shadow or watermark.
See for yourself: http://photobatch.stani.be
It shows a nice progress bar and estimates the time it will take.
There is a deb installer for Ubuntu Feisty/Gutsy
April 12, 2008 at 2:34 am
Instead of
for i in `ls *.jpg`;
you could use the simpler
for i in *.jpg;
If you also use “$i” (with the double quotes) instead of $i, your script would also work for filenames with embedded blanks.
September 18, 2008 at 2:34 am
You can use as well :
find . -name “*.jpg” -exec convert {} -resize 800×600 {} \;