Linux Blog


Section: Misc. Reference Manual Pages (1L)
Updated: 3 March 1994
Index Return to Main Contents


hpcdtoppm - convert a Photo-CD file into a portable bitmap file  


hpcdtoppm infile [-a] [{-C|-0|-Overview|-O}] file opt] [-c0] [-c-] [-c+] [-crop] [-d] [-dpi f] [-eps] [-epsd] [-epsg] [-fak scale] [-hori] [-i] [-l] [-m] [-n] [-pb pos] [-pgm] [-ph height] [-pl pos] [-pos] [-ppm] [-ps] [-psd] [-psg] [-pw width] [-r] [-rep] [-S long short] [-s] [-vert] [-x] [-ycc] [-1|-Base/16 |-128x192] [-2|-Base/4 |-256x384] [-3|-Base |-512x768] [-4|-4Base |-1024x1536] [-5|-16Base |-2048x3072] [-6|-64Base |-4096x6144] [outfile]  


This program accepts Photo-CD image or overview file data from the specified input file, infile (or, if the resolution is lower than 64Base and the file argument is specified as -, from standard input), and writes either Portable Bitmap Format or POSTSCRIPT to the specified output file (or to standard output if no file is specified).

On a standard Photo-CD, image files appear in photo_cd/images, where they appear in files with names of the form imgnnnn.pcd, where nnnn is a 4-digit-number. The overview file appears in photo_cd/overview.pcd.

Photo-CD images are stored using as many as 6 different resolutions:

          Format              Resolution
          ------              ----------
          64Base              4096x6144 (ProPhotoCD only)
          16Base              2048x3072
          4Base               1024x1536
          Base                512x768
          Base/4              256x384
          Base/16             128x192

The overview file employs Base/16 format.  


Invoking hpcdtoppm without arguments produces a list of default values. Note that you can supply only one size option.
Automatically determine image orientation (this option is experimental, and does not work for overview files).
{-C | -0 | -Overview | -O } file opt
Extract all images from an overview file. The mandatory file argument is the name of a ppm file; output files are named filennnn, where nnnn is a 4-digit number. Overview images are extracted in their original Base/16 format. The value of opt determines the orientation of the contact sheet image; recognized values are:
Do not rotate the image.
Rotate the picture counter-clockwise (portrait mode).
Rotate the picture clockwise (portrait mode).
Do not correct (brighten or darken) the image.
Darken the image.
Brighten the image.
Cut off the black frame which sometimes appears at the image borders.
Show only the decompressed difference rather than the complete image (applicable only to 4Base and 16Base images).
-dpi res
Set the printer resolution to res for dithered POSTSCRIPT images.
Write a RGB Encapsulated POSTSCRIPT color image.
Write a Floyd-Steinberg dithered image in Encapsulated POSTSCRIPT.
Write a grayscale image in Encapsulated POSTSCRIPT.
-fak scale
Set the scaling factor for dithered POSTSCRIPT images to scale.
Flip the image horizontally.
Send information from an image file header to standard error.
Rotate the picture counter-clockwise (portrait mode).
Write messages about the phases of decoding to standard error.
Do not rotate the image.
-pb pos
Set the bottom position of the POSTSCRIPT image to pos.
Write a pgm (grayscale) image.
-ph height
Set the height of the POSTSCRIPT image to height.
-pl pos
Set the leftmost position of the POSTSCRIPT image to pos.
Print the relative starting position of the data for the current resolution.
Write a ppm RGB (color) image.
Write a RGB POSTSCRIPT color image.
Write a Floyd-Steinberg dithered image in POSTSCRIPT.
Write a POSTSCRIPT grayscale image.
-pw width
Set the width of the POSTSCRIPT image to width.
Rotate the picture clockwise (portrait mode).
Try to jump over reading errors in the Huffman code.
-S long short
Cut out a subrectangle with boundaries defined by the values:
For the longer side of the image.
For the shorter side of the image.
where long and short take one of two forms:
Cut from position a to position b.
Starting at offset a, cut a length of b.
and where a and b are either integers representing pixel locations, or floating point values over the range [0.0 ... 1.0], representing the fraction of the length of a side.
Apply a simple sharpness operator to the luminosity channel.
Flip the image vertically.
Overskip Mode (applicable to Base/16, Base/4, Base and 4Base). In Photo-CD images the luminosity channel is stored in full resolution, the two chromaticity channels are stored in half resolution only and have to be interpolated. In Overskip Mode, the chromaticity channels of the next higher resolution are taken instead of interpolating. To see the difference, generate one ppm with and one ppm without this flag. Use pnmarith(1L) to generate the difference image of these two images. Call ppmhist(1L) for this difference or show it with xv(1L) (push the HistEq button in the color editor).
Write the image in ppm YCC format.
Extract the Base/16 image.
-2 | -Base/4 | -256x384
Extract the Base/4 image.
-3 | -Base | -512x768
Extract the Base image.
-4 | -4Base | -1024x1536
Extract the 4Base image.
-5 | -16Base | -2048x3072
Extract the 16Base image.
-6 | -64Base | -4096x6144
Extract the 64Base image. This resolution can be extracted from ProPhotoCD images only. The path of the 64Base extension files is derived from the path to the image file. This means that it doesn't work on stdin an the directory structure must be the very same as on the ProPhotoCD.


For POSTSCRIPT output (options -ps, -eps, -psg, -epsg, -psd, -epsg) you can define both the resolution and placement of the image. Both size and position are specified in points (1/72 inch).

The position of the image (where the origin is assumed to be at the lower left corner of the page) is controlled by the -pl and -pb options (applicable at all resolutions).

The size of color and grayscale images is changed with the -pw and -ph options. Every image pixel is mapped onto one POSTSCRIPT pixel.

There are three modes of control for dithered POSTSCRIPT:

Image size
(-pw and -ph)
Printer resolution
Scaling factor

These three factors are interdependent, hence no more then two can be specified simultaneously. Using -dpi and the -pw/-ph options together often yields pleasing results. Even using the default values for these options will produce results differing from those obtained without use of the options.  


The program ignores read protection.

The -i option is not working correctly.

Available information obout the Photo-CD format is vague; this program was developed by trial-and-error after staring at hex-dumps. Please send bugs reports and patches to the author.  


pnmarith(1L), ppm(5L), ppmhist(1L), ppmquant(1L), ppmtopgm(1L), ppmtorgb3(1L), xv(1L)  


The name hpcdtoppm stands for "Hadmut's pcdtoppm," to make it distinguishable in the event that someone else is building a similar application and naming it pcdtoppm. This is version 0.6.  


Copyright (c) 1992, 1993, 1994 by Hadmut Danisch ( This software is not public domain. Permission to use and distribute this software and its documentation for noncommercial use and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software may not be sold or used for profit-making activities.

Manual page extensively modified by R. P. C. Rodgers (