I have a directory full of Kodak Photo CD files (with file extension .pcd) and I was disappointed (and alarmed) to find that neither GIMP nor digiKam could open this old image format. Time to move these old files to a format with better software support.
How can a TIFF image file be produced from each Photo CD file using the Linux command line and ImageMagick?
This worked perfectly for me on a Bash command line:
for file in *.pcd;\
do convert $file[6] -colorspace RGB "`basename $file .pcd`.tiff";\
done
(This can all be typed onto a single line without the backslashes, but I've used the Bash backslash escape to break this long line into three, to make it easier to read on this page.)
The for file in *.pcd
statement selects all of the files in the current directory which have the file extension ".pcd". The do
statement executes a command-line instruction, in this case a call to the ImageMagick convert
tool, replacing $file
with the name of each file selected. And the loop is closed with the done
statement.
The basename $file .pcd
function simply returns the name of the current file without the directory path and without the file extension, allowing us to replace ".pcd" with a ".tiff" extension. This also tells ImageMagick to use TIFF as the output image format. (ImageMagick will allow other image formats.)
In the parameters to the convert
tool, the filename suffix of [6]
is necessary to tell ImageMagick to select the largest size of image stored in the PhotoCD file, that is 6144 pixels on its longest side and 4096 pixels on its shortest. A Kodak Photo CD file contains a scanned image in six different sizes, and you can choose the output image size produced by convert
by changing the value you use for this filename suffix:
[1]
produces an image 192 by 128 ("Base/16")[2]
produces an image 384 by 256 ("Base/4")[3]
produces an image 768 by 512 ("Base")[4]
produces an image 1536 by 1024 ("4 Base")[5]
produces an image 3072 by 2048 ("16 Base")[6]
produces an image 6144 by 4096 ("64 Base")[3]
.The parameter -colorspace RGB
seems to be necessary to get the colours to look right, otherwise the resulting image is badly washed out.