Home / Alt manpages / pcdindex(1)

  • pcdindex(1)
  • User command
  • linux

Build a Photo CD Contact Sheet with pcdindex

Someone hands you a stack of old Kodak Photo CDs, and pcdindex shows you what's on them without opening every image by hand. It reads a disc's overview file and writes one PPM image containing thumbnails of every photo plus their captions. Budget about 10 minutes if the disc is already mounted and Netpbm is installed. You need a readable overview.pcd file and enough disk space for the output.

1. Check the installed command

pcdindex is the old name for Netpbm's pcdovtoppm: on this machine it is a symbolic link straight to it. The installed package is Netpbm 2:11.05.02-1.1build1, and its usage text is worth reading because older documentation does not always agree with it on option spelling.

$ command -v pcdindex
/usr/bin/pcdindex
$ ls -l /usr/bin/pcdindex
... /usr/bin/pcdindex -> pcdovtoppm
$ pcdindex
Usage: /usr/bin/pcdindex [-m W] [-s S] [-a A] [-c N|n] [-f F] [-b|-w] <overview.pcd>

Run it with no arguments and it prints usage rather than doing anything destructive. There is no conventional --help or --version screen in this build. Reading a mounted disc and writing into a directory you own needs no elevated privilege.

Checkpoint: locate the overview file

A Photo CD usually exposes its overview at a path like /media/$USER/PHOTO_CD/overview.pcd. Swap in the real path for your system. This check only reads directory metadata, nothing more.

$ PCD='/path/to/overview.pcd'
$ test -r "$PCD" && printf 'readable: %s' "$PCD"
readable: /path/to/overview.pcd

If that test fails, check the mount point and filename before anything else. Do not fake it by creating an empty file with that name: pcdindex needs actual Photo CD overview data, not a file that merely has the right suffix.

2. Generate the default contact sheet

Give the overview file as the final argument and redirect standard output to a new PPM file.

$ pcdindex "$PCD" > overview.ppm

The default sheet is at most 1152 pixels wide, each thumbnail at most 192 pixels, up to six images across, on a black background, annotated with the built-in font. The program writes the image straight to standard output, so a missing or mistyped redirect fills your terminal with binary noise.

Check the result is actually a Netpbm image before you open it anywhere else:

$ pnmfile overview.ppm
overview.ppm: PPM raw, 1152 by 768 pixels, maxval 255

The exact dimensions depend on how many photos are on the disc and how they're laid out, so treat that sample line as a shape to expect rather than an exact promise. If pnmfile reports an error, look at the command's diagnostics and the output file size before you try a further conversion.

3. Fit more thumbnails on the page

-m sets the maximum output width, -s the maximum size of each thumbnail, and -a the maximum number across. All three shape the layout; none of them touch the source photographs.

$ pcdindex -m 768 -s 96 -a 8 "$PCD" > overview-small.ppm
$ pnmfile overview-small.ppm
overview-small.ppm: PPM raw, ... pixels, maxval 255

The installed usage text gives defaults of 1152, 192 and 6. Smaller numbers make a tighter sheet; larger ones make thumbnails and captions easier to read at the cost of a bigger file.

4. Choose colours and annotation options

-w switches to a white background; -b, the default, is black. -c with a number caps the colour count, or use -c n to skip quantisation entirely. -f with a font file replaces the built-in font when it doesn't suit the job.

$ pcdindex -w -c n -f /path/to/smallfont.pbm "$PCD" > overview-white.ppm

The font file has to exist and be readable, or the run fails. If a normal contact sheet is all you need, skip -f: the internal font is the default. Options stay short-form on this installed build, even though current upstream documentation also lists longer forms like -maxwidth and -white.

5. Convert a verified PPM when you need to

PPM is a fine intermediate format, but a JPEG is easier to send around. Pipe straight into ppmtojpeg if you don't need to keep the PPM:

$ pcdindex "$PCD" | ppmtojpeg > overview.jpg
$ file overview.jpg
overview.jpg: JPEG image data, ...

For anything you might need to debug later, keep overview.ppm around too. It separates "did the contact sheet generate" from "did the JPEG conversion work", which matters when only one of them goes wrong.

Common traps and recovery

  • Wrong command name assumed. This system has pcdindex, but expect documentation and newer scripts to call the same program pcdovtoppm.
  • Wrong option spelling copied from a stale manual. The local executable takes -m for width. A legacy pcdovtoppm man page may list a conflicting -w width entry, while here -w is the background-colour switch. Trust the local usage output over an old page.
  • Accidental overwrite. Shell redirection truncates an existing destination before the program even runs. Pick a new filename, or back up first with cp --preserve=all overview.ppm overview.ppm.bak. To undo a test run, remove only the file you just named, rm -- overview-small.ppm; never touch the original overview.pcd.
  • Unreadable input. A missing mount, wrong case in the filename, or a permissions slip all produce nothing useful. Re-run test -r "$PCD" and confirm the disc is actually mounted before you go further.

Done means

  • Command confirmed. pcdindex resolves to the installed Netpbm executable.
  • Input verified. The overview.pcd file is readable before you start.
  • Output checked. The generated PPM passes pnmfile with the layout options you chose.
  • Conversion traced. Any JPEG came from a verified PPM or a checked pipeline, not a guess.