Sunday, November 10, 2013

Tip Of The Day (2) : Batch resizing pictures in linux

How to batch resize pictures in Linux (Mint and Ubuntu based distros)


Don't forget to read the other tips:
  • Tip Of The Day (5) : Batch Script to resize pictures in linux (Nemo)

  • Tip Of The Day (4) : Bulk renaming files in linux
  • Tip Of The Day (3) : Linux Mint 13 and Petra Backports
  • Tip Of The Day (1) : Screenshot 



  • first install imagemagick
    sudo apt-get install imagemagick

    then open in terminal the folder containing your pictures you want to resize, and then type the following : 
    for file in *.[picture extension]; do convert $file -resize [size you want] [new-name]-$file; done

    example, for .JPG files that you want to resize in 800*600 (the file will be sized to fit in a 800*600 frame without destroying ratio)
    for file in *.JPG; do convert $file -resize 800x600 resized-$file; done

    Your resized pictures are now called resized-*.JPG (original pics are not overwritten) ie : 
    DSCF2248.JPG is now called resized-DSCF2248.JPG

    Now you have forum-ready pics, for fast upload and quick sharing ;)


    That's all folks !