Perform color correction on PPM files.
Synopsisppmcoco [-from <gamma>] [-to <gamma>] [<ppmin>] [<ppmout>]Arguments
- -from <gamma>
- Gamma coefficient of the display for which the image was designed. The default value 2.2 is assumed when this argument is omitted.
- -to <gamma>
- Gamma coefficient of the display on the image will be rendered. The default value 2.2 is assumed when this argument is omitted.
- <ppmin>
- Name of the PPM file to read. A single dash ("-") means that the PPM file is to be read on the standard input. See PNM and RLE file formats for more information about PPM files.
- <ppmout>
- Name of the PPM file into which the color corrected image will be written. Omitting this argument or providing a single dash ("-") means that the PPM data will be written to the standard output.
Description --- File "ppmcoco.cpp" illustrates how the DjVu Reference Library performs color correction on GPixmap objects. Each color image is in theory designed to be rendered on a particular device. In order to display this image on a different device, we need to correct the image in order to compensate the differences between the color profile of the design device (the device for which the image was designed) and the color profile of the rendering device (the device on which the image will be displayed.)
The current release of the DjVu Reference Library only implements gamma correction. Cathodic displays are reasonably well characterized by a single floating point number called ``gamma''. Typical gamma values are given in the table below:
computer gamma PC 2.5 Apple Macintosh 1.9 Silicon Graphics 1.4 Gamma correction is performed by function color_correct in class GPixmap. The argument of function color_correct must be the ratio between the gamma coefficient of the rendering device and the gamma coefficient of the design device. This function works best when both gamma coefficients are close, partly because the color values have a limited dynamical range, and partly because we do not exactly perform a regular gamma correction: regular gamma correction tends to reveal ugly data compression artifacts in the dark areas of the image. We suggest therefore to design images with a intermediate gamma coefficient. Value 2.2 gives decent results on all computers. This value is suggested by several photo editing programs (such as Photoshop), and is supported by virtually all scanner drivers.
Program ppmcoco reads a PPM file ppmin containing an image designed for a display whose gamma coefficient is specified with option -from. Color correction is then performed for a display whose gamma coefficient is specified with option -to. The corrected file is then written into PPM file ppmout.
Alphabetic index Hierarchy of classes