1Pnmgamma User Manual(0) Pnmgamma User Manual(0)
2
3
4
6 pnmgamma - perform gamma adjustment on a PNM image
7
8
10 pnmgamma {
11 -bt709tolinear |
12 -lineartobt709 |
13 -bt709tosrgb |
14 -srgbtobt709 } [-gamma=float] [-rgamma=float] [-ggamma=float]
15 [-bgamma=float]
16
17 [pnmfile]
18
19 pnmgamma [
20 -bt709ramp |
21 -srgbramp ] [-ungamma] [{gamma | redgamma greengamma bluegamma} [pnm‐
22 file]]
23
24
25
27 This program is part of Netpbm(1).
28
29 Pnmgamma performs gamma adjustment on pseudo-PNM images.
30
31 The PPM format specification specifies that certain sample values in a
32 file represent certain light intensities in an image. In particular,
33 they specify that the sample values are directly proportional to lumi‐
34 nance as defined by ITU-R Recommendation BT.709. BT.709 luminance as a
35 function of radiance is a power function modified with a linear ramp
36 near black.
37
38 However, people sometimes work with approximations of PPM and PGM where
39 the sample values represent intensity in different ways:
40
41 In one common variation, the sample value is directly proportional to
42 radiance (often called "linear intensity").
43
44 Another popular variation is to make the samples proportional to lumi‐
45 nance as defined by the International Electrotechnical Commission (IEC)
46 SRGB standard. The SRGB gamma transfer function is like the BT.709 one
47 except with different constants in it.
48
49 Note that SRGB is often spelled "sRGB". In this document, we use stan‐
50 dard English typography, though, which doesn't allow for that kind of
51 capitalization.
52
53 pnmgamma allows you to manipulate the gamma transfer function, thus
54 working with and/or creating pseudo-PPM files that are useful for vari‐
55 ous things.
56
57 For example, if you feed a true PPM to pnmgamma -bt709tolinear , you
58 get as output a file which is PPM in every respect except that the sam‐
59 ple values are radiances. If you feed such a file to pnmgamma -lin‐
60 earto709, you get back a true PPM.
61
62 The situation for PGM images is analogous. And pnmgamma treats PBM
63 images as PGM images.
64
65 When you feed a radiance-proportional pseudo-PPM image to a display
66 program that expects a true PPM, the display appears darker than it
67 should, so pnmgamma has the effect of lightening the image. When you
68 feed a true PPM to a display program that expects radiance-proportional
69 sample values, and therefore does a gamma adjustment of its own on
70 them, the display appears lighter than it should, so pnmgamma with a
71 gamma value less than one (the multiplicative inverse of whatever gamma
72 value the display program uses) has the effect of darkening the image.
73
74
76 The form of the parameters depends on whether you're using the old syn‐
77 tax or the new syntax. With the old syntax, the parameters are a mix‐
78 ture of gamma values and the input file name. With the new syntax, the
79 only parameter is the input file name and you specify gamma values with
80 option.
81
82 You use the old syntax if you specify -bt709ramp (or its synonym -cier‐
83 amp) or -srgramp or if you don't specify any transfer function at all
84 (and thus default to a simple exponential). Otherwise, you use the new
85 syntax.
86
87 With the old syntax, you may specify a single gamma value or 3 separate
88 gamma values (red, green, and blue) or no gamma values. In any case,
89 the meanings of those parameters is the same as the more modern -gamma,
90 -rgamma, -ggamma, and -bgamma options described below.
91
92
93
95 In addition to the options common to all programs based on libnetpbm
96 (most notably -quiet, see
97 Common Options ⟨index.html#commonoptions⟩ ), pnmgamma recognizes the
98 following command line options:
99
100
101
102
103 -bt709tolinear
104 Convert the image from BT.709 luminance to radiance. I.e. con‐
105 vert from true PPM or PGM to a radiance-linear variation that
106 can be used with certain tools that need it.
107
108 This option was new in Netpbm 10.32 (February 2006).
109
110
111 -lineartobt709
112 Convert the image from radiance to BT.709 luminance. I.e. con‐
113 vert to true PPM or PGM from a radiance-linear variation.
114
115 You get true BT.709 (ergo true PPM or PGM) only if you use the
116 default gamma value (i.e. don't specify -gamma, etc.).
117
118 This option was new in Netpbm 10.32 (February 2006).
119
120
121 -bt709tosrgb
122 Convert the image from BT.709 luminance to SRGB luminance. I.e.
123 convert from true PPM or PGM to an SRGB-based variation that is
124 required by certain tools and display devices.
125
126 You get true SRGB only if you use the default gamma value (i.e.
127 don't specify -gamma, etc.).
128
129 This option was new in Netpbm 10.32 (February 2006).
130
131
132 -srgbtobt709
133 Convert the image from SRGB luminance to BT.709 luminance. I.e.
134 convert to true PPM or PGM from an SRGB-based variation.
135
136 This option was new in Netpbm 10.32 (February 2006).
137
138
139 -bt709ramp
140 Same as -lineartobt709, but using the old syntax.
141
142 This option was renamed in Netpbm 10.32 (February 2006). Before
143 that, its name is -cieramp.
144
145
146 -cieramp
147 This is an obsolete synonym for -bt709ramp.
148
149 The name of this option comes from a former belief that this was
150 a standard of CIE (International Commission On Illumination),
151 but it now (August 2005) looks like it never was.
152
153
154 -srgbramp
155 Convert the image from radiance to SRGB luminance. Note that it
156 is true SRGB only if you use the default gamma value (i.e. don't
157 specify any gamma parameters).
158
159 This is an old syntax option. There is no equivalent in the new
160 syntax because it really shouldn't be a function of pnmgamma at
161 all. It exists solely for backward compatibility. The reason
162 it shouldn't exist is that the way to do this conversion consis‐
163 tent with the Netpbm philosophy is do a -lineartobt709 followed
164 by a -bt709tosrgb. It's exactly analogous to the way you have
165 to convert from PNG to TIFF by doing a pngtopam followed by a
166 pnmtotiff. The -srgbramp option actually dates to before there
167 was a standard definition of what the sample values of a Netpbm
168 image measure, and pnmgamma considered radiance-linear to be the
169 proper intermediate format.
170
171
172 -ungamma
173 Apply the inverse of the specified transfer function (i.e. go
174 from gamma-adjusted luminance to radiance).
175
176 This is valid only with -bt709ramp (aka -cieramp), -srgbramp,
177 and the default exponential transfer function.
178
179
180 -gamma=float
181 This specifies the gamma value to use in the transfer function.
182 All of the transfer functions involve an exponent, and the gamma
183 value is that exponent.
184
185 The standards specify a particular gamma value. If you use any‐
186 thing else, you are varying from the standard.
187
188 The default is the standard value. For the simple exponential
189 transfer function (which is not a standard), the default is 2.2.
190
191 In the -bt709tosrgb and -srgbtobt709 conversions there are two
192 exponents. -gamma affects the "to" function; the "from" func‐
193 tion always uses the standard gamma value.
194
195 If you specify one of the component-specific options (-rgamma,
196 etc.), that overrides the -gamma value.
197
198 With the -bt709ramp (aka -cieramp), -srgbramp, or the default
199 exponential transfer function, you can't actually use this
200 option, but you specify the same thing with parameters.
201 ⟨#parameters⟩
202
203 This option was new in Netpbm 10.32 (February 2006).
204
205
206 -rgamma=float
207
208 -ggamma=float
209
210 -bgamma=float
211 These options are just like -gamma, except they specify the
212 value for a particular one of the color components.
213
214 If you don't specify this option for a particular color compo‐
215 nent, the default is the -gamma value (or -gamma's default if
216 you didn't specify that either).
217
218 With the -bt709ramp (aka -cieramp), -srgbramp, or the default
219 exponential transfer function, you can't actually use this
220 option, but you specify the same thing with parameters.
221 ⟨#parameters⟩
222
223 This option was new in Netpbm 10.32 (February 2006).
224
225
226 -maxval=maxval
227 This is the maxval of the output image. By default, the maxval
228 of the output is the same as that of the input.
229
230 Because the transformation is not linear, you need a greater
231 maxval in the output in order not to lose any information from
232 the input. For example, if you convert to radiance-linear sam‐
233 ple values with -ungamma -bt709ramp and default gamma value, and
234 your maxval is 255 on both input and output, 3 different input
235 sample values all generate output sample value 254. In order to
236 have a different output sample value for each input sample
237 value, you would need an output maxval at least 3 times the
238 input maxval.
239
240 This option was new in Netpbm 10.32 (February 2006). Before
241 that, you can achieve the same result by increasing the maxval
242 of the input or decreasing the maxval of the output using
243 pamdepth.
244
245
246
247
249 A good explanation of gamma is in Charles Poynton's Gamma FAQ at
250 http://www.poynton.com/GammaFAQ.html" (1) and Color FAQ at
251 http://www.poynton.com/ColorFAQ.html" (1).
252
253 In brief: The simplest way to code an image is by using sample values
254 that are directly proportional to the radiance of the color components.
255 Radiance is a physical quantification based on the amount of power in
256 the light; it is easily measurable in a laboratory, but does not take
257 into account what the light looks like to a person. It wastes the sam‐
258 ple space because the human eye can't discern differences between low-
259 radiance colors as well as it can between high-radiance colors. So
260 instead, we pass the radiance values through a transfer function that
261 makes it so that changing a sample value by 1 causes the same level of
262 perceived color change anywhere in the sample range. We store those
263 resulting values in the image file. That transfer function is called
264 the gamma transfer function and the transformation is called gamma
265 adjusting.
266
267 The gamma-adjusted value, proportional to subjective brightness, are
268 known as the luminance of the pixel.
269
270 There is no precise objective way to measure luminance, since it's psy‐
271 chological. Also, perception of brightness varies according to a vari‐
272 ety of factors, including the surrounding in which an image is viewed.
273 Therefore, there is not just one gamma transfer function.
274
275 Virtually all image formats, either specified or de facto, use gamma-
276 adjusted values for their sample values.
277
278 What's really nice about gamma is that by coincidence, the inverse
279 function that you have to do to convert the gamma-adjusted values back
280 to radiance is done automatically by CRTs. You just apply a voltage to
281 the CRT's electron gun that is proportional to the gamma-adjusted sam‐
282 ple value, and the radiance of the light that comes out of the screen
283 is close to the radiance value you had before you applied the gamma
284 transfer function!
285
286 And when you consider that computer video devices usually want you to
287 store in video memory a value proportional to the signal voltage you
288 want to go to the monitor, which the monitor turns into a proportional
289 drive voltage on the electron gun, it is really convenient to work with
290 gamma-adjusted sample values.
291
292
294 pnm(1)
295
296
298 Copyright (C) 1991 by Bill Davidson and Jef Poskanzer.
299
301 This manual page was generated by the Netpbm tool 'makeman' from HTML
302 source. The master documentation is at
303
304 http://netpbm.sourceforge.net/doc/pnmgamma.html
305
306netpbm documentation 30 June 2007 Pnmgamma User Manual(0)