1Pgmtoppm User Manual(0)                                Pgmtoppm User Manual(0)
2
3
4

NAME

6       pgmtoppm - colorize a PGM (grayscale) image into a PPM (color) image
7
8

SYNOPSIS

10       pgmtoppm [-black=colorspec1] [-white=colorspec2]
11        [pgmfile]  pgmtoppm  -map=filename  [pgmfile] pgmtoppm colorspec [pgm‐
12       file] pgmtoppm colorspec1-colorspec2 [pgmfile]
13
14       Minimum unique abbreviation of option is acceptable.  You may use  dou‐
15       ble  hyphens  instead  of single hyphen to denote options.  You may use
16       white space in place of the equals sign to separate an option name from
17       its value.
18
19

DESCRIPTION

21       This program is part of Netpbm(1).
22
23       If all you want to do is convert PGM to PPM, keeping the same gray pix‐
24       els,
25         you may not need to.  All Netpbm programs that expect PPM input also
26         recognize PGM.  And if you must have a PPM file, use ppmtoppm
27         instead.  It is more efficient and easier to use.
28
29       pgmtoppm reads a PGM as input and produces a PPM file as output with  a
30       specific color assigned to each gray value in the input.
31
32       You  can  specify  the  color in the output to which black in the input
33       maps,
34         and the color to which white maps.  All the gray  values  in  between
35       map
36         linearly  (across  a  three  dimensional space) to colors between the
37       black and
38         white colors you specify.
39
40       Use the -black and -white options for this.  For historical
41         reasons, you can alternatively use a non-option argument  to  specify
42       the
43         colors.  If you do that, pgmtoppm interprets the color argument
44         like this: if the argument takes the form black-white,
45         it has the effect of -black=black -white=white
46         If  instead  there is no hyphen in the color argument, it has the ef‐
47       fect of
48         -white=color_argument.
49
50       Because of the historical syntax, it is not possible to let both
51         -black and -white default (but you shouldn't want to --
52         see below for advice on making such a null conversion).
53
54
55       You can alternatively specify an entire colormap with the -map option.
56
57
58       A more direct way to specify a particular color to replace each partic‐
59       ular  gray  level is to use pamlookup.  You make an index file that ex‐
60       plicitly associates a color with each possible gray level.
61
62
63

OPTIONS

65       In addition to the options common to all programs  based  on  libnetpbm
66       (most notably -quiet, see
67        Common  Options  ⟨index.html#commonoptions⟩ ), pgmtoppm recognizes the
68       following command line options:
69
70
71
72
73       -black=colorspec
74              The program maps black pixels in the input to this color in  the
75              output.  The default is black.
76
77              Specify  the  color (color) as described for the argument of the
78              pnm_parsecolor()                 library                 routine
79              ⟨libnetpbm_image.html#colorname⟩ .
80
81              You cannot specify this together with -map.
82
83              This  option  was  new  in Netpbm 10.97 (December 2021).  Before
84              that,
85                use the color argument.
86
87
88       -white=colorspec
89              The program maps white pixels in the input to this color in  the
90              output.  The default is white.
91
92              Specify  the  color (color) as described for the argument of the
93              pnm_parsecolor()                 library                 routine
94              ⟨libnetpbm_image.html#colorname⟩ .
95
96              You cannot specify this together with -map.
97
98              This  option  was  new  in Netpbm 10.97 (December 2021).  Before
99              that,
100                use the color argument.
101
102
103       -map=filename
104              This option specifies a complete mapping of gray values  in  the
105              input to
106                  color  values  in the output.  The map file (named filename)
107              is just
108                  a ppm file; it can be any shape, all  that  matters  is  the
109              colors in
110                  it  and  their  order.  In this case, black gets mapped into
111              the first color
112                  in the map file, and white gets mapped to the last and  gray
113              values in
114                  between  are  mapped linearly onto the sequence of colors in
115              between.  The
116                  maxval of the output image is the maxval of the map image.
117
118
119
120
121

NOTE - MAXVAL

123       When you don't use -map, the "maxval," or depth, of the output image is
124       the same as that of the input image.  The maxval affects the color res‐
125       olution, which may cause quantization errors you  don't  anticipate  in
126       your output.  For example, you have a simple black and white image as a
127       PGM with maxval 1.  Run this image through pgmtoppm 0f/00/00 to try  to
128       make the image black and faint red.  Because the output image will also
129       have maxval 1, there is no such thing as faint red.  It has to  be  ei‐
130       ther  full-on red or black.  pgmtoppm rounds the color 0f/00/00 down to
131       black, and you get an output image that is nothing but black.
132
133       The fix is easy: Pass the input through pamdepth on the way  into  pgm‐
134       toppm  to increase its depth to something that would give you the reso‐
135       lution you need to get your desired color.  In this case,  pamdepth  16
136       would  do  it.  Or spare yourself the unnecessary thinking and just say
137       pamdepth 255.
138
139       PBM input is a special case.  While  you  might  think  this  would  be
140       equivalent to a PGM with maxval 1 since only two gray levels are neces‐
141       sary to represent a PBM image, pgmtoppm, like all Netpbm  programs,  in
142       fact treats it as a maxval of 255.
143
144

SEE ALSO

146       ppmtoppm(1),   pamdepth(1),  rgb3toppm(1),  ppmtopgm(1),  ppmtorgb3(1),
147       ppm(1), pgm(1)
148
149

AUTHOR

151       Copyright (C) 1991 by Jef Poskanzer.
152

DOCUMENT SOURCE

154       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
155       source.  The master documentation is at
156
157              http://netpbm.sourceforge.net/doc/pgmtoppm.html
158
159netpbm documentation            02 October 2021        Pgmtoppm User Manual(0)
Impressum