Category: batch processing

Re-generating images

4:25 pm on October 21st, 2007, by Andy Tawse

I always forget where to find this info so I’m putting it here so I can find it next time I need it.

If you’ve got a load of images which have been resized but don’t look good for some reason (e.g you used PHP gd) you can regenerate them on the server using ImageMagick:

mogrify -path thumbs -thumbnail 90x *.jpg

will resize all jpgs in a directory to a width of 90 pixels and save them into the thumbs directory.

In this case I then had to rename them all (on Linux):

for file in *.jpg; do mv $file `echo $file | sed ‘s/\(.*\.\)jpg/\190.jpg/’`; done

This renames all jpgs to 90.jpg

http://www.imagemagick.org/Usage/thumbnails/

Comment » | batch processing, imagemagick, images, linux

Back to top