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:

for i in `ls *.jpg`;
convert $i -resize 800×600 $i

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.


3 Responses to “HOWTO batch/mass image resize”

  1. Mark Says:

    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:

    It shows a nice progress bar and estimates the time it will take.

    There is a deb installer for Ubuntu Feisty/Gutsy

  2. Michael Mauch Says:

    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.

  3. Sioc Says:

    You can use as well :

    find . -name “*.jpg” -exec convert {} -resize 800×600 {} \;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: