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  colorspec  [pgmfile] pgmtoppm colorspec1-colorspec2 [pgmfile]
11       pgmtoppm -map=mapfile [pgmfile]
12
13       Minimum unique abbreviation of option is acceptable.  You may use  dou‐
14       ble  hyphens  instead  of single hyphen to denote options.  You may use
15       white space in place of the equals sign to separate an option name from
16       its value.
17
18

DESCRIPTION

20       This program is part of Netpbm(1).
21
22       pgmtoppm  reads a PGM as input and produces a PPM file as output with a
23       specific color assigned to each gray value in the input.
24
25       If you specify one color argument, black in the pgm  file  stays  black
26       and  white  in  the  pgm file turns into the specified color in the ppm
27       file.  Gray values in between are linearly mapped to differing intensi‐
28       ties of the specified color.
29
30       If  you specify two color arguments (separated by a hyphen), then black
31       gets mapped to the first color and white gets mapped to the second  and
32       gray  values in between get mapped linearly (across a three dimensional
33       space) to colors in between.
34
35       Specify the  color  (color)  as  described  for  the  argument  of  the
36       pnm_parsecolor() library routine ⟨libnetpbm_image.html#colorname⟩ .
37
38       Also,  you  can  specify  an entire colormap with the -map option.  The
39       mapfile is just a ppm file; it can be any shape, all  that  matters  is
40       the colors in it and their order.  In this case, black gets mapped into
41       the first color in the map file, and white gets mapped to the last  and
42       gray  values in between are mapped linearly onto the sequence of colors
43       in between.  The maxval of the output image is the maxval  of  the  map
44       image.
45
46       A more direct way to specify a particular color to replace each partic‐
47       ular gray level is to use pamlookup.   You  make  an  index  file  that
48       explicitly associates a color with each possible gray level.
49
50

NOTE - MAXVAL

52       When you don't use -map, the "maxval," or depth, of the output image is
53       the same as that of the input image.  The maxval affects the color res‐
54       olution,  which  may  cause quantization errors you don't anticipate in
55       your output.  For example, you have a simple black and white image as a
56       PGM  with maxval 1.  Run this image through pgmtoppm 0f/00/00 to try to
57       make the image black and faint red.  Because the output image will also
58       have  maxval  1,  there  is  no  such thing as faint red.  It has to be
59       either full-on red or black.  pgmtoppm rounds the color  0f/00/00  down
60       to black, and you get an output image that is nothing but black.
61
62       The  fix  is easy: Pass the input through pamdepth on the way into pgm‐
63       toppm to increase its depth to something that would give you the  reso‐
64       lution  you  need to get your desired color.  In this case, pamdepth 16
65       would do it.  Or spare yourself the unnecessary thinking and  just  say
66       pamdepth 255.
67
68       PBM  input  is  a  special  case.   While you might think this would be
69       equivalent to a PGM with maxval 1 since only two gray levels are neces‐
70       sary  to  represent a PBM image, pgmtoppm, like all Netpbm programs, in
71       fact treats it as a maxval of 255.
72
73

SEE ALSO

75       pamdepth(1), rgb3toppm(1), ppmtopgm(1), ppmtorgb3(1), ppm(1), pgm(1)
76
77

AUTHOR

79       Copyright (C) 1991 by Jef Poskanzer.
80

DOCUMENT SOURCE

82       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
83       source.  The master documentation is at
84
85              http://netpbm.sourceforge.net/doc/pgmtoppm.html
86
87netpbm documentation           10 December 2006        Pgmtoppm User Manual(0)
Impressum