Friday, November 11, 2005

Batch convert PhotoCD Images

ImageMagick a wonder command line program to batch convert photos from one format to another.

The syntax is very easy:
$ convert myImage.tif myImage.jpg

This convert the myImage file from tiff to jpeg.

I recently had to convert 90 Photo CD images to a more usable format. Her is a short script to do this in a batch:

#!/bin/bash
for pcdfile in *.PCD
do
base=`basename $pcdfile .PCD`
convert -normalize $base.PCD[5] $base.tif
done

this converts all the PCD files in the current directory to level 5 resolution tiff files (3072 by 2048 at 72 dpi)
The normalize paramater does somethin akin to AutoLevels in photoshop. I chose to do this because Photo CD images are heaily oversaturated in magenta, red and orange. This 5 line script saved me from cnverting one by one in another application

Listen to this article Listen to this article