Next Previous Contents

Color correction for pnm2ppa

The pnm2ppa project team ppa-rpms@users.sourceforge.net

v0.3, July 11, 2000


Information and instructions for color correction of pnm2ppa color printing. http://sourceforge.net/projects/pnm2ppa (Updated for pnm2ppa-1.0 and later.)

Overview of Color correction.

Color Pixmap input to pnm2ppa (ppm format, produced by the ghostscript output devices ppmraw or ppm) specifies the color of a pixel as three coordinates (Red, Green, Blue) in the range 0-255. The program pnm2ppa converts these to relative amounts of Cyan, Magenta and Yellow ink drops printed on the page.

Color correction allows the user to attempt to match the printed colors to some reference colors, such as those displayed on the terminal, or those printed on a different printer, or those printed on the same printer with a different driver (such as the Win9x drivers supplied by HP with their PPA printers).

The color output from pnm2ppa can be controlled in two ways:

Color correction is specified by three color intensity functions (curves), one for each of Red, Green, and Blue. In their simplest form, these curves have a standard form controlled by a single "gamma" parameter such as RedGammaIdx. The more sophisticated correction, in the file pnm2ppa.gamma, specifies these curves more generally as a set of values that are interpolated between.

Note that, in principle, different color corrections are needed for different print quality settings, and for different brands and qualities of paper!

At present the methods for constructing a color correction for pnm2ppa are not very user-friendly. If you can improve them, please help!.

Color correction with "gamma" values in the configuration file.

You must first use pnm2ppa to produce a file gamma.ppm. To do this, type

pnm2ppa -g -i - -o /dev/lp0
(replace /dev/lp0 by whatever printer device your PPA printer uses, or use ... -o - | lpr -l , etc.). Note also that as pnm2ppa is not receiving any ghostscript input to tell it the paper size, this must be correctly specified by a configuration file entry or, e.g., a -s a4 option, if the default US Letter paper is not being used. This procedure will both print a color calibration page, and create a file gamma.ppm in the current directory.

The printed output is an array of sets of three colored bands, red, blue and green, each of which increases in brightness from left to right. The topmost set of bands should be referrred to as bands "0", the next ones as "1", etc.

To color-correct the printer so that its colors match those on the terminal screen, you should now attempt to view the file gamma.ppm using some application (such as the GNU image manipulation program gimp) that can view .ppm files. For each color, identify the printed band (0, 1, 2, ... etc) that most closely corresponds to the brightness profile shown on the screen. The default values are:

RedGammaIdx 6
GreenGammaIdx 3
BlueGammaIdx 3
Enter your modified values for these in the pnm2ppa configuration file (usually /etc/pnm2ppa.conf).

To color-correct with respect to another printer (or the Win9x drivers), you must manage to print gamma.ppm on that other device, then make the comparison.

Color correction using a "gamma file".

A "gamma correction file" is a text file containg three lines of 16 hexadecimal numbers in the range 00 - ff (decimal 0-255), e.g.,

 20 28 30 40 50 60 70 a0 b0 c0 c8 d0 e0 ea f0 ff
 20 28 30 40 50 60 68 70 78 80 90 b0 c0 d0 e0 ff
 10 20 28 38 40 48 60 70 80 90 a0 c0 d0 e0 f0 ff  
which are the interpolation functions for red green and blue color intensities.

The program pnm2ppa will use a default correction file /etc/pnm2ppa.gamma if it exists, unless the --noGamma option is used. The default correction file location can be changed by using the pnm2ppa option -F gammafile , where "gammafile" is the name (including the full path) of the gamma correction file to be used.

Currently, there are two available tools for constructing a gamma correction file:


Next Previous Contents