Penguin
Annotated edit history of pnmgamma(1) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 pnmgamma
2 !!!pnmgamma
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 WHAT IS GAMMA?
7 SEE ALSO
8 AUTHOR
9 ----
10 !!NAME
11
12
13 pnmgamma - perform gamma correction on a PNM image
14 !!SYNOPSIS
15
16
17 __pnmgamma__ [[__-ungamma__] [[__-cieramp__]
18 [[''value'' [[''pnmfile'']]__
19 pnmgamma__ [[__-ungamma__] [[__-cieramp__] ''redgamma
20 greengamma bluegamma'' [[''pnmfile'']
21 !!DESCRIPTION
22
23
24 Reads a psuedo-PNM image as input. Performs gamma
25 correction, and produces a PNM image as output.
26
27
28 Alternatively, this program can undo gamma
29 correction.
30
31
32 The PPM specification states that the sample values in the
33 image are nonlinear, i.e. not directly proportional to light
34 intensity, i.e. gamma corrected. But there exist images that
35 are PPM in every respect except that their sample values are
36 directly proportional to light intensity. People may loosely
37 refer to these as PPM, but they are not. __pnmgamma__
38 converts these pseudo-PPM images to true PPM by performing
39 gamma correction. To get true PPM, you must specify the
40 __-cieramp__ option and no gamma values. That causes
41 __pnmgamma__ to apply the CIE Rec. 709 gamma transfer
42 function, as specified by the PPM format
43 specification.
44
45
46 On the other hand, you can use the __-ungamma__ option to
47 convert from true PPM to linear RGB pseudo-PPM. (Again, if
48 the input is true PPM, specify the __-cieramp__ option
49 and no gamma values).
50
51
52 The situation for PGM images is analogous. And
53 __pnmgamma__ treats PBM images as PGM
54 images.
55
56
57 You can also apply a different transfer function (which
58 means you don't end up with a true PPM image) by selecting
59 the gamma values as arguments or omitting the
60 __-cieramp__ option. The gamma value is the power to
61 which the input value is raised in the transfer function. A
62 value of 1 means the output is the same as the input. A
63 value less than one makes the output samples numerically
64 less than the input samples; A value greater than one makes
65 the samples numerically greater.
66
67
68 Without the __-cieramp__ option, the transfer function is
69 a simple power function. With __-cieramp__, it is a power
70 function modified with a linear ramp near black, as
71 described in CIE Rec. 709.
72
73
74 When you feed a linear PPM image to a display program that
75 expects a true PPM, the display appears darker than it
76 should, so __pnmgamma__ has the effect of lightening the
77 image. When you feed a true PPM to a display program that
78 expects linear sample values, and therefore does a gamma
79 correction of its own on them, the display appears lighter
80 than it should, so __pnmgamma__ with a gamma value less
81 than one (the multiplicative inverse of whatever gamma value
82 the display program uses) has the effect of darkening the
83 image.
84 !!WHAT IS GAMMA?
85
86
87 A good explanation of gamma is in Charles Poynton's GammaFAQ
88 at
89
90
91 In brief: The simplest way to code an image is by using
92 sample values that are directly proportional to the
93 intensity of the color components. But that wastes the
94 sample space because the human eye can't discern differences
95 between low-intensity colors as well as it can between
96 high-intensity colors. So instead, we pass the light
97 intensity values through a transfer function that makes it
98 so that changing a sample value by 1 causes the same level
99 of perceived color change anywhere in the sample range. We
100 store those resulting values in the image file. That
101 transfer function is called the gamma transfer function and
102 the transformation is called gamma correcting.
103
104
105 Virtually all image formats, either specified or de facto,
106 use gamma-corrected values for their sample
107 values.
108
109
110 What's really nice about gamma is that by coincidence, the
111 inverse function that you have to do to convert the
112 gamma-corrected values back to real light intensities is
113 done automatically by CRTs. You just apply a voltage to the
114 CRT's electron gun that is proportional to the
115 gamma-corrected sample value, and the intensity of light
116 that comes of the screen is close to the intensity value you
117 had before you applied the gamma transfer
118 function!
119
120
121 And when you consider that computer video devices usually
122 want you to store in video memory a value proportional to
123 the signal voltage you want to go to the monitor, which the
124 monitor turns into a proportional drive voltage on the
125 electron gun, it is really convenient to work with
126 gamma-corrected sample values.
127 !!SEE ALSO
128
129
130 pnm(5)
131 !!AUTHOR
132
133
134 Copyright (C) 1991 by Bill Davidson and Jef
135 Poskanzer.
136 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.