Sunday, November 18, 2007

Another trick using ImageMagick

Last blog was about batch resizing images using ImageMagick. But ImageMagick is more than just a resizing tool. It's kinda Adobe PhotoShop (or GIMP) for command line. You might be thinkin - what might a commandline photo editing tool be possibly use of? Well, think of resizing, watermarking and putting a nice frame to images. And to make matters worse, there are around 3000 of them and are in different formats (ie, gif, jpeg, png, bmp, etc..). Well, ImageMagick can do them all in a single command line!

ImageMagick has lots and lots of cool features. I already said, it's Adobe PhotoShop for command line and I mean it! More on ImageMagick can be found on its website

Okay now lets get down to the Magick.. Here's the problem:

Sometimes photos taken by digital cameras are just seem faded out.. Jus like image below.

How do we fix it? Well, the simplest answer is overlay.. This can also be done in Adobe Photoshop (or GIMP). I got this idea from here.

1. Duplicate the image layer
2. Apply layer blending mode as Overlay for the upper image.

But who does the hard work of opening Photoshop (or GIMP) and all the mess when i can do it with a single command using ImageMagick. We use composite command of ImageMagick (single line).

composite -compose overlay 
<faded_image> <faded_image> <output_bright_image>

(plz note that there <faded_image> is mentioned twice as the image is overlayed upon another instance of the same image)

composite -compose overlay colorless.jpg colorless.jpg bright.jpg

Here's before and after..

Before: Faded Image

After: ImageMagick Trick

Now who says commandline is boring?

No comments:

Post a Comment