1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD><TITLE>Pamlevels User Manual</TITLE>
</HEAD><BODY>
<H1>pamlevels</H1>
Updated: 10 April 2018
<BR>
<A HREF="#index">Table Of Contents</A>
<H2>NAME</H2>
pamlevels - effect a "levels" transformation
<H2 id="synopsis">SYNOPSIS</H2>
<B>pamlevels</B>
<b>-from1</b> <I>from1</I>
<b>-to1</b> <I>to1</I>
<b>-from2</b> <I>from2</I>
<b>-to2</b> <I>to2</I>
[<b>-from3</b> <I>from3</I>
<b>-to3</b> <I>to3</I>]
[<b>-linear</b>]
[<b>-fitbrightness</b>]
[<I>pamfile</I>]
<H2 id="description">DESCRIPTION</H2>
<p>This program is part of <a href="index.html">Netpbm</a>.
<p><b>pamlevels</b> reads a Netpbm image from <i>pamfile</i> or standard
input, applies a "levels" transformation, and sends the result to
standard output. It finds a unique transformation that maps color
<i>from1</i> to <i>to1</i>, color <i>from2</i> to <i>to2</i>,
and—if <b>-from3</b> and <b>-to3</b> are supplied—color
<i>from3</i> to <i>to3</i>. Transformations based on two mappings are linear
in light intensity and those based on three mappings quadratic. The
color-mapping options may be shortened to <b>-f1</b>...<b>-f3</b> and
<b>-t1</b>...<b>-t3</b>.
<p>Color values have the following format:
<i>color</i>[:<i>scale</i>], where <i>color</i> is a
<a href="libppm.html#colorname"> Netpbm color specification</a> and
<i>scale</i> an optional coefficient that is applied to each RGB component (in
the standard Netpbm gamma-adjusted color space) of <i>color</i>.
<p>When the transformation is linear (i.e. uses two mappings) and preserves
zero (i.e. maps black to black), it corresponds to multiplication of light
intensity by a constant and preserves
<A HREF="http://www.c-f-systems.com/ColorIntegrity.html">color integrity</A>.
<H2 id="examples">EXAMPLES</H2>
In the examples below, <code>\</code> denotes a line continuation:
<p>To brighten an image by setting a darker white point—
<pre>pamlevels -f1 black -t1 black \
-f2 white:0.9 -t2 white in.ppm > out.ppm</pre>
<p>To adjust the white point—
<pre>
pamlevels -f1 black -t1 black\
-f2 rgbi:0.9/0.83/0.80 -t2 white in.ppm > out.ppm</pre>
<p>To set a lighter black point—
<pre>pamlevels -f1 white:0.06 -t1 black
-f2 white -t2 white in.ppm > out.ppm</pre>
<p>To increase brightness by compression—
<pre>pamlevels \
-f1 black -t1 black -f2 white -t2 white \
-f3 white:0.5 -t3 white:0.6 in.ppm > out.ppm</pre>
The latter tranformation is similar to gamma-correction.
<h2 id="options">OPTIONS</h2>
<dl>
<dt><b>-from1</b>
<dt><b>-to1</b>
<dt><b>-from2</b>
<dt><b>-to2</b>
<dt><b>-from3</b>
<dt><b>-to3</b>
<dd>
These options define the mappings of input colors to output colors that anchor
the transformation function. See <a href="#description">DESCRIPTION</a>.
<p>
You must specify at least two of these pairs.
<dt><b>-linear</b>
<dd>This option tells <b>pamlevels</b> to work with the intensity-linear
variation on PPM where the samples are proportional to light intensity, rather
than brightness (gamma-adjusted) as in true PPM. The input must be of this
form and the <b>pamlevels</b> makes the output of this form.
<p>Note that the numbers in a color specification like
<b>rgbi:0.9/0.83/0.80</b> are brightness levels (gamma-adjusted) regardless of
the input and output format.
<p>You cannot use this with <b>-fitbrightness</b> because that function is
not implemented.
<dt><b>-fitbrightness</b>
<dd>This option selects a transformation which is not very useful - it is
linear or quadratic in brightness rather than light intensity of the pixels.
There is no physical basis for doing it this way and the result is normally
undesirable.
<p>Note that many tools other than Netpbm do the transformation this way. One
use for this option is simply to demonstrate the poor result of this method.
<p>One advantage of this transformation is that it is faster, because the
input and output image formats use brightness values. The result is
approximately correct.
<p>You cannot use this with <b>-linear</b> because that function is not
implemented.
</dl>
<H2 id="seealso">SEE ALSO</H2>
<B><A HREF="pnmnorm.html">pnmnorm</A></B>,
<B><A HREF="pamrecolor.html">pamrecolor</A></B>,
<B><A HREF="pnmgamma.html">pnmgamma</A></B>,
<B><A HREF="pam.html">pnm</A></B>
<H2 id="author">AUTHOR</H2>
<p>This program was first submitted by Anton Shepelev
(<A HREF="mailto:anton.txt@gmail.com">anton.txt@gmail.com</A>).
<H2 id="history">HISTORY</H2>
<p><b>pamlevels</b> was new in Netpbm 10.83 (June 2018).
<HR>
<H2 id="index">Table Of Contents</H2>
<UL>
<LI><A HREF="#synopsis">SYNOPSIS</A>
<LI><A HREF="#description">DESCRIPTION</A>
<LI><A HREF="#examples">EXAMPLES</A>
<LI><A HREF="#options">OPTIONS</A>
<LI><A HREF="#seealso">SEE ALSO</A>
<LI><A HREF="#author">AUTHOR</A>
<LI><A HREF="#history">HISTORY</A>
</UL>
</BODY>
</HTML>
|