Author Topic: How To - Mass Resize Images  (Read 1472 times)

lwfitz

  • DEFCON 1
  • Posts: 1760
  • sudo rm -rf /
    • View Profile
How To - Mass Resize Images
« on: June 20, 2013, 08:31:58 AM »
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

Code: [Select]
sudo apt-get install imagemagick
First we need to create a directory for our thumbnails

Code: [Select]
mkdir ~/thumbs
Then create a copy of the images we want to resize and place them in ~/thumbs

Code: [Select]
cp ~/gallery_images/* ~/gallery_images/thumbs/
Then cd to our thumbs folder

Code: [Select]
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

Code: [Select]
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

Code: [Select]
mogrify -resize 640×480! *.jpg
Thats it. Hope this helps someone.

VastOne

  •      v-ger
  • Posts: 4122
    • View Profile
    • VSIDO Community
Re: How To - Mass Resize Images
« Reply #1 on: June 20, 2013, 11:33:35 AM »
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 Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

lwfitz

  • DEFCON 1
  • Posts: 1760
  • sudo rm -rf /
    • View Profile
Re: How To - Mass Resize Images
« Reply #2 on: June 20, 2013, 11:33:36 PM »
Thanks!

Yeah I know its stock on VSIDO but Im hoping someone else (not using VSIDO) may read it someday  ;D

VastOne

  •      v-ger
  • Posts: 4122
    • View Profile
    • VSIDO Community
Re: How To - Mass Resize Images
« Reply #3 on: June 24, 2013, 03:32:00 AM »
^ Good idea...

Thanks lwfitz!
VSIDO      VSIDO Twitter     VSIDO FB     VSIDO Google+   

I dev VSIDO

Digit

  • Techno Hippie
  • Posts: 295
  • savant (alegedly), polymath (wannabe)
    • View Profile
    • wastedartist.com
Re: How To - Mass Resize Images
« Reply #4 on: October 01, 2013, 09:29:20 PM »
good tip there.

also may want to check out the
Code: [Select]
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.  :)