the joy of non-standard graphic formats

It was a wild and carefree time in the nineties.  Partying with friends, going on vacations, as well as traveling to exotic locations.  Some of my friends had not only gone on vacations but they had Kodak create some CD’s with their holiday photos. It was pretty cool at that time so I went out and did that as well for some of my photos.

Fast forward to today.  For the most part nobody gets their film developed nor converted to photo CD’s, we simply copy them from the camera to our computer and cut out some of those obsolete steps.

While going through my desk drawers I found some of these old photo CD’s. It was only at this point that I realized that the solution at that time was fine but none of my current programs can deal with this proprietary PCD as a photo format.

This format, although proprietary, can be manipulated by a number of different programs.  Some of the choices available such as Irfanview for Windows or iPhoto for the Macintosh.  This is not the limit of available choices just a few of those that can be purchased.  I didn’t want to purchase a piece of software to convert seven CD’s never to be used again.

Yet, I was lucky enough to find some source code which can only convert from PCD to JPEG but that was exactly the conversion that I was looking for.

PCDTOJPEG

The utility, pcdtojpeg, is a command line program which is distributed as three source files.

Simply get the latest source at http://sourceforge.net/projects/pcdtojpeg/files/latest/download.

I didn’t compile this on Windows or for the Macintosh, just on Linux.  Unlike a lot of Linux projects there was no makefile nor complicated shell scripts.  Just a single command will compile both source files into the binary.

> g++ main.cpp pcdDecode.cpp -ljpeg -lpthread -o pcdtojpeg
> chmod 777 pcdtojpeg
> ./pcdtojpeg

pcdtojpeg, version 1.0.12 
Copyright (C) 2009-2015 Sandy McGuffog
JPEG compression code Copyright (C) 1991-1998, Thomas G. Lane.

Usage:  ./pcdtojpeg [options] file1 [file2]

Valid options:
-h            Print this message
-v            Verbose file information
-m            Process the file as monochrome
-D50          Process for a white balance of D50
-D65          Process for a white balance of D65 <default>
-q nnn        JPEG file quality (nnn range 1 to 100 <100>)
-b n.n        Brightness adjustment (n.n range -2.0 to 2.0 <0.0>)
-r n          Highest resolution to extract (n range 0 to 5):
                 0 - Base/16 (128 x 192)
                 1 - Base/4 (256 x 384)
                 2 - Base (512 x 768)
                 3 - 4Base (1024 x 1536)
                <4 - 16Base (2048 x 3072)>
                 5 - 64Base (4096 x 6144)

I actually relish the command line, so using this utility was perfect.  To use this program, I created a small shell script which takes all PCD files from the current directory and converts them to JPEG.

#!/bin/bash
convert()
{
   ./pcdtojpeg -q 100 -r 4 $1 ${1}-4.jpeg  &
}

LIST=`ls -1 *.pcd` 

for i in $LIST
do
   convert $i
done
This entry was posted in Command line, Setup From Scratch. Bookmark the permalink.