Resizing multiple images in Linux at once.

mkdir pics80

Make a directory to put them in.

Change directory to where the images all are.

for i in $(ls *.jpg); do convert $i -resize 80 -quality 80 pics80/np-$i; done

Set the .jpg to whatever type of images you are resizing.

We are doing an ls of the  directory, assigning the files it sees of that type to the variable $i, we are then using the convert command that comes with ImageMagick to resize the pictures to 80 pixels height, and reducing the quality of the image to 80% to make it a better file size and more usable for the web. We then put it in the directory we made named pics80 and rename it np-(New Pics)and the filename associated with it in the variable $i.

I hope this helps someone out, I know I am always converting pics, and do not wanna forget how I did it after struggling to figure it out the first time.

Bookmark the permalink.

One Response to Resizing multiple images in Linux at once.

  1. Emmy says:

    Great tip, thanks! This saved me a lot of time. FYI, this doesn’t work on files which have a space in the file name. I’m sure there’s some way to overcome that but in my case it was just as easy to rename them first!

Leave a Reply