From a44cc9866fa7e104f2a1f580838d5fa615574982 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 3 Oct 2021 01:00:42 +0000 Subject: miscellaneous update git-svn-id: http://svn.code.sf.net/p/netpbm/code/userguide@4150 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- pgmtoppm.html | 109 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 81 insertions(+), 28 deletions(-) diff --git a/pgmtoppm.html b/pgmtoppm.html index 7663c982..3f56b76f 100644 --- a/pgmtoppm.html +++ b/pgmtoppm.html @@ -2,7 +2,7 @@ Pgmtoppm User Manual

pgmtoppm

-Updated: 10 December 2006 +Updated: 02 October 2021
Table Of Contents @@ -12,6 +12,13 @@ pgmtoppm - colorize a PGM (grayscale) image into a PPM (color) image

SYNOPSIS

+pgmtoppm +[-black=colorspec1] +[-white=colorspec2] + [pgmfile] + +pgmtoppm -map=filename [pgmfile] + pgmtoppm colorspec [pgmfile]
@@ -20,7 +27,6 @@ pgmtoppm - colorize a PGM (grayscale) image into a PPM (color) image
-pgmtoppm -map=mapfile [pgmfile]

Minimum unique abbreviation of option is acceptable. You may use double hyphens instead of single hyphen to denote options. You may use white @@ -33,39 +39,86 @@ space in place of the equals sign to separate an option name from its value.

pgmtoppm reads a PGM as input and produces a PPM file as output with a specific color assigned to each gray value in the input. -

If you specify one color argument, black in the pgm file stays -black and white in the pgm file turns into the specified color in the -ppm file. Gray values in between are linearly mapped to differing -intensities of the specified color. - -

If you specify two color arguments (separated by a hyphen), then -black gets mapped to the first color and white gets mapped to the -second and gray values in between get mapped linearly (across a three -dimensional space) to colors in between. - -

Specify the color (color) as described for the argument of the pnm_parsecolor() -library routine. - -

Also, you can specify an entire colormap with the -map -option. The mapfile is just a ppm file; it can be any shape, -all that matters is the colors in it and their order. In this case, -black gets mapped into the first color in the map file, and white gets -mapped to the last and gray values in between are mapped linearly onto -the sequence of colors in between. The maxval of the output image is -the maxval of the map image. - +

You can specify the color in the output to which black in the input maps, + and the color to which white maps. All the gray values in between map + linearly (across a three dimensional space) to colors between the black and + white colors you specify. + +

Use the -black and -white options for this. For historical + reasons, you can alternatively use a non-option argument to specify the + colors. If you do that, pgmtoppm interprets the color argument + like this: if the argument takes the form black-white, + it has the effect of black=black -white=white + If instead there is no hyphen in the color argument, it has the effect of + white=color_argument. + +

Because of the historical syntax, it is not possible to let both + -black and -white default (but you shouldn't want to -- + see below for advice on making such a null conversion). + +

You can alternatively specify an entire colormap with the -map +option. +

A more direct way to specify a particular color to replace each particular gray level is to use pamlookup. You make an index file that explicitly associates a color with each possible gray level. +

If all you want to do is convert PGM to PPM, keeping the same gray pixels, + you may not need to. All Netpbm programs that expect PPM input also + recognize PGM. And if you must have a PPM file, use ppmtoppm + instead. It is more efficient and easier to use. + +

OPTIONS

-

There are no command line options defined specifically -for pgmtoppm, but it recognizes the options common to all -programs based on libnetpbm (See -Common Options.) +

In addition to the options common to all programs based on libnetpbm +(most notably -quiet, see +Common Options), pgmtoppm recognizes the following +command line options: + +

+ +
-black=colorspec + +
The program maps black pixels in the input to this color in the output. +The default is black. + +

Specify the color (color) as described for +the argument of +the pnm_parsecolor() library routine. + +

You cannot specify this together with -map. + +

This option was new in Netpbm 10.97 (December 2021). Before that, + use the color argument. + +

-white=colorspec + +
The program maps white pixels in the input to this color in the output. +The default is white. + +

Specify the color (color) as described for +the argument of +the pnm_parsecolor() library routine. + +

You cannot specify this together with -map. + +

This option was new in Netpbm 10.97 (December 2021). Before that, + use the color argument. + +

-map=filename + +
This option specifies a complete mapping of gray values in the input to + color values in the output. The map file (named filename) is just + a ppm file; it can be any shape, all that matters is the colors in + it and their order. In this case, black gets mapped into the first color + in the map file, and white gets mapped to the last and gray values in + between are mapped linearly onto the sequence of colors in between. The + maxval of the output image is the maxval of the map image. + +
+

NOTE - MAXVAL

When you don't use -map, the "maxval," or depth, -- cgit 1.4.1