Friday, September 03, 2010

A Tool that I used to Resize image/s via command line for Juancho's Album

Juancho's Album

As Juancho (8layer penguin mascot) is 8layer's Penguin on the Go!. We thought of capturing Juancho's moments in and out and just anything roundabout.

So here's a peek of his pictures and loot.

Most of the pictures taken were shot using our sony cybershot DCS-T2 camera (no adverstising fee paid)

Each picture eats up 1.9MB to 2.9MB. The goal is to resize the image to my preferred size. Doing this task could easily be done using a program called "mogrify" .

What is Mogrify?

Mogrify is a command utility that will help you to resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

It is also one of the command-line utilities for manipulating images included in the ImageMagick

How Mogrify Basically Works?

Mogrify with Image Settings "-geometry 1000x1000" usually resize image of 1000 pixels wide or 1000 pixels high from 1.9MB to2.9MB to 190kb to 320kb. What makes it very useful is that you can resize a number of pictures all at the same time with just a single line command.

Now, I am ready to upload pictures to picasa album.

Apart from resizing, a useful trick is its ability to to reduce specific image to 50% from its original size, This is achieved by simply using its “-resize” option. See example below:

This command will give an output like the image below.

Now, we know that with mogrify, we can resize and reduce images, even multiple images at the same time.

What about file/ image format conversion?

For example, if you want to convert your .JPG file to .png file, use the “-format” option as this will do the trick.

Likewise, use the wildcard to do multiple files conversion

$mogrify -format png *.JPG

With this command, you are able to convert all our JPG images to the png format:

If this guide aint basic enough, don't forget to check the mogrify manual for more information on its usage.

$man mogrify

Enjoy mogrifying!

No comments: