• About
  • Linux Feeds & more
  • Archives
  • Categories
  • Posts Tagged ‘ImageMagick’

    Batch Resize of Multiple Photos


    2008 - 05.05

    After searching Synaptic Package Manager for a batch photo resizing program, I came across a nifty program called ImageMagick.  An excerpt from its description reads:

    ImageMagick is a set of programs to manipulate various image formats (JPEG, TIFF, PhotoCD, PBM, XPM, etc…). All manipulations can be achieved through shell commands as well as through an X11 graphical interface (display).

    Possible effects: colormap manipulation, channel operations, thumbnail creation, image annotation, limited drawing, image distortion, etc.

    The only effect I needed for, however was image re-sizing.  Here’s what I did under Hardy:

    First, you need to install ImageMagick:

    jason@ubuntu:~$ sudo apt-get install imagemagick

    Create a folder to put all the images you want to resize in.  For my images, I just created a folder named “Batch” on my desktop.

    jason@ubuntu:~$ cd /home/jason/Desktop/
    jason@ubuntu:~/Desktop$ mkdir batch
    jason@ubuntu:~/Desktop$ cd /home/jason/Desktop/batch
    jason@ubuntu:~/Desktop/batch$

    Now comes the time to do the actual resizing.  I resized mine to a width of 640.  The aspect ratio will stay the same if resizing just the width.

    jason@ubuntu:~/Desktop/batch$ mogrify -resize 640 *.JPG

    Note that the file extension is case sensitive and will give you an error message otherwise.  If you want to force a particular aspect ratio (such as 640 x 480) then try this:

    jason@ubuntu:~/Desktop/batch$ mogrify -resize 640×480! *.JPG

    And there you have it!  There are alot of other effects that you can try with this program.  For more effects to use at the command line, see the ImageMagick website.