How To - Mass Resize Images

lwfitz

While creating a gallery on a website I had to find a way to mass resize my images to create thumbnails and this is what I came up with.

First, if you dont have imagemagick installed then you will need to run

sudo apt-get install imagemagick

First we need to create a directory for our thumbnails

mkdir ~/thumbs

Then create a copy of the images we want to resize and place them in ~/thumbs

cp ~/gallery_images/* ~/gallery_images/thumbs/

Then cd to our thumbs folder

cd ~/thumbs

Now we can resize all the images in our thumbs folder using the mogrify command
As far as I know this will work with all image types (png, gif, jpg, jpeg... etc)

This will keep the aspect ratio

mogrify -resize 250 *.jpg

If you want to force resizing without maintaining the aspect ratio you can run
the command using a specific size such as

mogrify -resize 640×480! *.jpg

Thats it. Hope this helps someone.
Don't Be A Dick!

VastOne

Very nice How To lwfitz, useful!

imagemagick is a stock install on VSIDO and/or it can be pulled in from vsido-welcome
VSIDO      VSIDO Change Blog    

    I dev VSIDO

lwfitz

Thanks!

Yeah I know its stock on VSIDO but Im hoping someone else (not using VSIDO) may read it someday  ;D
Don't Be A Dick!

VastOne

VSIDO      VSIDO Change Blog    

    I dev VSIDO

Digit

good tip there.

also may want to check out the convert command from imagemagick too.

would be nice if one day we have so many imagemagick tips here that we end up needing a whole forum section dedicated to it.   ... a guy can dream.  :)