version 2, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
pgmtoppm |
|
|
2 |
!!!pgmtoppm |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
NOTE - MAXVAL |
|
|
7 |
SEE ALSO |
|
|
8 |
AUTHOR |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
|
|
13 |
pgmtoppm - colorize a PGM (grayscale) image into a PGM (color) image |
|
|
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__pgmtoppm__ ''colorspec'' [[''pgmfile'']__ |
|
|
18 |
pgmtoppm__ ''colorspec1''__-__''colorspec2'' |
|
|
19 |
[[''pgmfile'']__ |
|
|
20 |
pgmtoppm -map__ ''mapfile'' |
|
|
21 |
[[''pgmfile''] |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
Reads a PGM as input. Produces a PPM file as output with a |
|
|
26 |
specific color assigned to each gray value in the |
|
|
27 |
input. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
If you specify one color argument, black in the pgm file |
|
|
31 |
stays black and white in the pgm file turns into the |
|
|
32 |
specified color in the ppm file. Gray values in between are |
|
|
33 |
linearly mapped to differing intensities of the specified |
|
|
34 |
color. |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
If you specify two color arguments (separated by a dash), |
|
|
38 |
then black gets mapped to the first color and white gets |
|
|
39 |
mapped to the second and gray values in between get mapped |
|
|
40 |
linearly (across a three dimensional space) to colors in |
|
|
41 |
between. |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
You can specify the color in one of five ways: |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
o |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
A name, from an X11-style color names file. |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
o |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
An X11-style hexadecimal specifier: rgb:r/g/b, where r g and |
|
|
57 |
b are each 1- to 4-digit hexadecimal numbers. |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
o |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
An X11-style decimal specifier: rgbi:r/g/b, where r g and b |
|
|
64 |
are floating point numbers between 0 and 1. |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
o |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
For backwards compatibility, an old-X11-style hexadecimal |
|
|
71 |
number: #rgb, #rrggbb, #rrrgggbbb, or |
|
|
72 |
#rrrrggggbbbb. |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
o |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
For backwards compatibility, a triplet of numbers separated |
|
|
79 |
by commas: r,g,b, where r g and b are floating point numbers |
|
|
80 |
between 0 and 1. (This style was added before MIT came up |
|
|
81 |
with the similar rgbi style.) |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
Also, you can specify an entire colormap with the |
|
|
85 |
__-map__ option. The mapfile is just a __ppm__ file; |
|
|
86 |
it can be any shape, all that matters is the colors in it |
|
|
87 |
and their order. In this case, black gets mapped into the |
|
|
88 |
first color in the map file, and white gets mapped to the |
|
|
89 |
last and gray values in between are mapped linearly onto the |
|
|
90 |
sequence of colors in between. |
|
|
91 |
!!NOTE - MAXVAL |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
The |
|
|
95 |
pgmtoppm__, like all Netpbm programs, can |
|
|
96 |
accept a PBM file as if it were PGM. The maxval of this |
|
|
97 |
image is 1, because only two gray values are needed: black |
|
|
98 |
and white. Run this image through __pgmtoppm 0f/00/00__ |
|
|
99 |
to try to make the image black and faint red. Because the |
|
|
100 |
output image will also have maxval 1, there is no such thing |
|
|
101 |
as faint red. It has to be either full-on red or black. |
|
|
102 |
__pgmtoppm__ rounds the color 0f/00/00 down to black, and |
|
|
103 |
you get an output image that is nothing but |
|
|
104 |
black. |
|
|
105 |
|
|
|
106 |
|
|
|
107 |
The fix is easy: Pass the input through __pnmdepth__ on |
|
|
108 |
the way into __pgmtoppm__ to increase its depth to |
|
|
109 |
something that would give you the resolution you need to get |
|
|
110 |
your desired color. In this case, __pnmdepth 16__ would |
|
|
111 |
do it. Or spare yourself the unnecessary thinking and just |
|
|
112 |
say __pnmdepth 255 .__ |
|
|
113 |
!!SEE ALSO |
|
|
114 |
|
|
|
115 |
|
2 |
perry |
116 |
pnmdepth(1), rgb3toppm(1), ppmtopgm(1), |
|
|
117 |
ppmtorgb3(1), ppm(5), |
1 |
perry |
118 |
__pgm(5)__ |
|
|
119 |
!!AUTHOR |
|
|
120 |
|
|
|
121 |
|
|
|
122 |
Copyright (C) 1991 by Jef Poskanzer. |
|
|
123 |
---- |