Batch reduce resolution of images in Ubuntu Linux

David Nash bash, linux 4 Comments

Open a terminal window or shell (who needs a GUI!?)
sudo apt-get install imagemagick
cd image_folder
mkdir resized
for f in *jpg
do
convert -resize 30% $f resized/$f
done

Easier than Photoshop, I reckon!

I needed this today for some photos I was uploading. Photos from recent cameras are huge and Australian bandwidth doesn’t cut it. So this really helps.

Obviously you only need to do the first line once. I found this in the Ubuntu forums but it took me a while to find the right combination of keywords in Google. View the original thread.

I needed to change jpg to JPG, because the camera used uppercase and Linux is case-sensitive. 30% was good for me but you may need to change that.

If you don’t understand this, ask me, I’m happy to help!

Comments 4

  1. Post
    Author

    I used this today:

    for i in *jpg; do mogrify -resize 50% -gravity Center -crop 552×561+0+0 $i; done

    Overwrites the file, resizes it 50% then crops to 552x 561 pixels.

  2. Post
    Author
    1. Post
      Author

Leave a Reply

Your email address will not be published. Required fields are marked *