Debian Codegraph @

userguide/pamaltsat.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
2 <html><head><title>Pamaltsat User Manual</title></head>
3 <body>
4 <h1>pamaltsat</h1>
5 Updated: 14 September 2018
6 <br>
7 <a href="#index">Table Of Contents</a>
8
9 <h2>NAME</h2>
10 pamaltsat - increase or decrease the saturation of an image using one of
11 several alternative methods.
12
13 <h2 id="synopsis">SYNOPSIS</h2>
14
15 <b>pamaltsat</b>
16 [<b>-method</b> <i>name</i>]
17 [<b>-strength</b> <i>number</i>]
18 [<b>-linear</b>]
19 [<i>infile</i>]
20
21 <h2 id="description">DESCRIPTION</h2>
22
23 <p>This program is part of <a href="index.html">Netpbm</a>.
24
25 <p><b>pamaltsat</b> decreases or increases the saturation of a Netpbm image by
26 one of various non-standard (<i>alt</i>ernative) methods.
27
28 <p>The input is a Netpbm image from Standard Input or a file named by the
29 arguments. The output is a Netpbm image in the same format written to
30 Standard Output.
31
32 <p>The most conventional way to change the saturation of an image is what
33 <b>pambrighten</b> does.
34
35
36 <h2 id="examples">EXAMPLES</h2>
37
38 <p>To increase saturation by a factor of 2.1 using the
39 logarithmic method:
40
41 <pre>
42 <kbd>
43 pamaltsat -method log -strength 2.1 test.ppm
44 </kbd>
45 </pre>
46
47 <p>To convert a color image to grayscale:
48
49 <pre>
50 <kbd>
51 pamaltsat -strength 0 test.ppm
52 </kbd>
53 </pre>
54
55
56 <h2 id="saturation_methods">SATURATION METHODS</h2>
57
58 <p>The following saturation methods are available.
59
60 <h3>Logarithmic Method</h3>
61
62 <p>This saturation model is inspired by the concept of
63 <a href="http://www.c-f-systems.com/ColorIntegrity.html">color integrity</a>,
64 which works with color in terms of intensity ratios, where intensity is a
65 value of the
66 <a href="https://en.wikipedia.org/wiki/Luminosity_function">luminosity
67 function</a>, rather than brightness, or the numerical value of the sample in
68 the image file. From this viewpoint, it is natural to define the saturation
69 of a color as the ratio of maximum and minimum intensities of its primary
70 components. In order, however, to make saturation an additive value and to
71 endow the <b>-strength</b> parameter with the semantics of a multiplier,
72 it is convenient to operate on the logarithm of that ratio. The addition of
73 such saturations acquires physical sense, and multiplication corresponds to
74 the raising of intensity to the power of the multiplier.
75
76 <p>With this method, <b>pamaltsat</b> raises the intensity of each component
77 to the power of the <b>strength</b> value. Since the total intensity of the
78 resulting color will differ from that of the original, it is necessary to
79 restore the intensity by multiplying the component intensities of the
80 saturated color by the ratio of the intensity of the original color to that of
81 the saturated color.
82
83 <p>Although it is always possible to decrease saturation by any given factor,
84 there are two cases where it cannot be increased. When the total intensity
85 (or brightness) of a color is too high for the desired
86 saturation, <b>pamaltsat</b> applies the maximum possible saturation that
87 keeps the original intensity. For example, any color with at least one
88 component at the maxiumum is already fully saturated. When one of the primary
89 components is zero, the definition of saturation given above no longer works
90 because of a zero in the denominator. <b>pamaltsat</b> offers no special
91 treatment of this situation because it does not create discontinuities and
92 therefore produces no visible defects at reasonable strength levels. When,
93 however, strength approaches infinity, each color tends to its primary
94 component with the highest intensity.
95
96 <p>This method was invented by Anton Shepelev.
97
98
99 <h3>Spectral Method</h3>
100
101 <p>This is the default method. It treats color as a spectrum with three
102 bands: one for the intensity of each primary component. Since neutral gray
103 has a uniform (constant) spectrum, saturation can be measured as the
104 difference of the spectrum of the given color from the uniform spectrum of the
105 same total intensity. The spectral method uses one of the simplest measures
106 of such a difference: the difference between the highest and lowest component
107 intensities, which is an additive value and therefore amenable to
108 multiplication with good physical sense. Although a complete hue-saturation
109 model can be dervied from this approach, <b>pamaltsat</b> need not concern
110 itself with it because it always preserves both hue and total intensity.
111
112 <p>In order to change saturation, <b>pamaltsat</b> first multiplies the
113 intensity of each component by the desired strength. The saturation of the
114 result is the strength times the saturation of the original, and likewise the
115 total intensity, but it is then restored by subtraction of the neutral gray
116 with a suitable intensity.
117
118 <p>The effect of this method on each component intensity may be expressed in
119 the following equation:
120 <pre>
121 <span style="font-family: monospace">
122 sat = orig * strength - Iorig * (strength - 1)
123 </span>
124 </pre>
125 where <span style="font-family: monospace">sat</span> is the saturated
126 sample, <span style="font-family: monospace">orig</span> the original sample,
127 and <span style="font-family: monospace">Iorig</span> the total intensity of
128 the original color.
129
130 <p>The method is also related to color integrity because both its operations
131 are part of that concept: multiplication of component intensities by the same
132 quotient is an important operation because changes brightness but keeps color
133 balance, and subtraction of a constant from all component intensities is
134 described by the inventor of color integrity as &quot;subtraction of
135 white.&quot;
136
137 <p>This procedure may produce both negative and over-unity component
138 intensities. For such samples, <b>pamaltsat</b> decreases the strength to the
139 highest value that keeps the resulting color in range.
140
141 <p>This method was invented by Anton Shepelev.
142
143
144 <h2 id="options">OPTIONS</h2>
145
146 <p>In addition to the options common to all programs based on libnetpbm
147 (most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
148 Common Options</a>), <b>pamaltsat</b> recognizes the following
149 command line options:
150
151 <dl>
152 <dt><b>-method</b> <i>method</i>
153 <dd>specifies the saturation method to use:
154 <table>
155 <tr><th>method name</th><th>option value</th></tr>
156 <tr><td>Logarithmic</td><td><kbd>log </kbd></td></tr>
157 <tr><td>Spectral </td><td><kbd>spectrum</kbd></td></tr>
158 </table>
159
160 <p>The default is <b>spectrum</b>
161
162 <dt><b>-strength</b> <i>strength</i>
163
164 <dd>This specifies a real nonnegative factor whereby to modify saturation. A
165 value greater than unity will increase saturation, whereas a value less than
166 unity will decrease it. Unity will leave the image unchanged, and zero will
167 produce greyscale output according to Rec 709.
168
169 <b>pamaltsat</b> preserves the total intensity of each pixel and never
170 affects neutral gray pixels.
171
172 <p>This option is mandatory.
173
174 <dt><b>-linear</b>
175
176 <dd>This tells <b>pamaltsat</b> that the input is the intensity-linear
177 variation of a Netpbm image forat, in which the samples are proportional to
178 light intensity rather than to brightness, as they are in true&mdash;or
179 gamma-adjusted&mdash; Netpbm image formats.
180 </dl>
181
182 <h2 id="usage_notes">USAGE NOTES</h2>
183
184 <p>Since <b>pamaltsat</b> does not affect neutral colors, you should adjust
185 the color balance before saturation. You can do this with <b>pamlevels</b>.
186
187
188 <h2 id="extensibility">EXTENSIBILITY</h2>
189
190 <b>pamaltsat</b> is written with an eye to extending it with new saturation
191 methods, which programmers are welcome to contribute. The only requirement is
192 that every new method depend on a single strength parameter with the semantics
193 described under the <b>-strength</b> command-line option.
194
195
196 <h2 id="seealso">SEE ALSO</h2>
197
198 <p>
199 <a href="pambrighten.html">pambrighten</a>,
200 <a href="ppmflash.html">ppmflash</a>,
201
202
203 <h2 id="author">AUTHOR</h2>
204
205 <p>This program was first submitted by Anton Shepelev
206 (<a href="mailto:[email protected]">[email protected]</a>).
207
208 <h2 id="history">HISTORY</h2>
209
210 <p><b>pamaltsat</b> was new in Netpbm 10.84 (September 2018).
211
212
213 <h2 id="index">Table Of Contents</h2>
214 <ul>
215 <li><a href="#synopsis">SYNOPSIS</a>
216 <li><a href="#description">DESCRIPTION</a>
217 <li><a href="#examples">EXAMPLES</a>
218 <li><a href="#saturation_methods">SATURATION METHODS</a>
219 <li><a href="#options">OPTIONS</a>
220 <li><a href="#usage_notes">USAGE NOTES</a>
221 <li><a href="#extensibility">EXTENSIBILITY</a>
222 <li><a href="#seealso">SEE ALSO</a>
223 <li><a href="#author">AUTHOR</a>
224 <li><a href="#history">HISTORY</a>
225 </ul>
226
227
228 </body>
229 </html>
230