1Pngtopam User Manual(0) Pngtopam User Manual(0)
2
3
4
6 pngtopam - convert a PNG image into a Netpbm image
7
8
10 pngtopam [-verbose] [-alphapam | -alpha | -mix] [-background=color]
11 [-gamma=value] [-text=filename] [-time] [pngfile]
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
20 This program is part of Netpbm(1).
21
22 pngtopam reads a PNG image (Portable Network Graphics) as input and
23 produces a Netpbm image as output. The type of the output file depends
24 on the input file - if it's black & white, pngtopam creates a PBM file.
25 If it's grayscale, pngtopam creates a PGM file. Otherwise, it creates
26 a PPM file. Except that with the -alphapam option, it always creates a
27 PAM file. That file has tuple type GRAYSCALE_ALPHA or RGB_ALPHA
28 depending on whether the input has color or not.
29
30
32 -verbose
33 Display various information about the input PNG image and the
34 conversion process.
35
36 If you want even more information about the PNG image, use
37 pngcheck (not part of Netpbm).
38
39
40 -alphapam
41 Produce a single output image containing the main image (fore‐
42 ground) and the alpha channel or transparency mask. This image
43 is in the PAM format with tuple type of either GRAYSCALE_ALPHA
44 (which has a depth of 2 channels) or RGB_ALPHA (which has a
45 depth of 4 channels).
46
47 You can specify only one of -alphapam, -alpha, and -mix. With
48 none of them, pngtopam produces an image of the foreground of
49 the input image and discards transparency information.
50
51 This option was new in Netpbm 10.44 (September 2008).
52
53
54 -alpha Output the alpha channel or transparency mask of the image. The
55 result is either a PBM file or a PGM file, depending on whether
56 different levels of transparency appear.
57
58 pngtopam discards the main image (the foreground).
59
60 You can specify only one of -alphapam, -alpha, and -mix. With
61 none of them, pngtopam produces an image of the foreground of
62 the input image and discards transparency information.
63
64
65 -mix Compose the image with the transparency or alpha mask against a
66 background. The background color is determined by the bKGD
67 chunk in the PNG, except that you can override it with -back‐
68 ground. If the PNG has no bKGD chunk and you don't specify
69 -background, the background color is white.
70
71 You can specify only one of -alphapam, -alpha, and -mix. With
72 none of them, pngtopam produces an image of the foreground of
73 the input image and discards transparency information.
74
75
76 -background=color
77 This option specifies the background color with which to mix the
78 image when you specify -mix.
79
80 color is as described for the argument of the ppm_parsecolor()
81 library routine ⟨libppm.html#colorname⟩ .
82
83 Examples:
84
85
86
87 · -background=rgb:01/ff/80
88
89 · -background=rgbi:1/255/128
90
91
92 If you don't specify -background, the background color is what
93 is specified in the PNG image, and if the PNG doesn't specify
94 anything, white.
95
96 You cannot specify -background unless you also specify -mix.
97 Before Netpbm 10.27 (March 2005), you could specify -background
98 without -mix and it was just ignored. (This caused a usability
99 problem).
100
101
102
103 -gamma=value
104 Converts the image to a new display-gamma value. If a gAMA
105 chunk is present in the png-file, pngtopam uses the specified
106 image-gamma value. If not, pngtopam considers the image-gamma
107 to be 1.0. Based on the image-gamma and the display-gamma given
108 with this option, pngtopam adjusts the colors written to the
109 pnm-file.
110
111 Because the gammas of uncompensated monitors are around 2.6,
112 which results in an image-gamma of 0.45, some typical situations
113 are: when the image-gamma is 0.45 (use -verbose to check) and
114 the picture is too light, your system is gamma-corrected, so
115 convert with '-gamma 1.0'. When no gAMA chunk is present or the
116 image-gamma is 1.0, use 2.2 to make the picture lighter and 0.45
117 to make the picture darker.
118
119 One oddity to be aware of when using -gamma on an image with
120 transparency: The PNG image specifies that a certain color is
121 transparent, i.e. every pixel in the image of that color is
122 transparent. But pngtopam interprets this as applying to the
123 gamma-corrected space, and there may be less precision in that
124 space than in the original, which means multiple uncorrected
125 colors map to the same corrected color. So imagine that the
126 image contains 3 shades of white and specifies that one of them
127 is transparent. After gamma correction, those three shades are
128 indistinguishable, so pngtopam considers pixels of all three
129 shades to be transparent.
130
131 If this is not what you want, don't use gamma. Instead, use
132 pnmgamma on the output.
133
134
135
136 -text=file
137 Writes the tEXt and zTXt chunks to a file, in a format as
138 described in the pnmtopng user manual. These chunks contain
139 text comments or annotations.
140
141
142 -time Prints the tIME chunk to stderr.
143
144
145
146
148 pnmtopng(1), pnmtopng(1), ptot, pnmgamma(1), pnm(1)
149
150 For information on the PNG format, see http://schaik.com/png
151 ⟨http://schaik.com/png⟩ .
152
153
155 A PNG image contains a lot of information that can't be represented in
156 Netpbm formats. Therefore, you lose information when you convert to
157 another format with "pngtopam | pnmtoxxx". If there is a specialized
158 converter that converts directly to the other format, e.g. ptot to con‐
159 vert from PNG to TIFF, you'll get better results using that.
160
161
163 There could be an option to include PNG comment chunks in the output
164 image as PNM comments instead of putting them in a separate file.
165
166 The program could be much faster, with a bit of code optimizing. As
167 with any Netpbm program, speed always takes a back seat to quick
168 present and future development.
169
170
172 pngtopam was new in Netpbm 10.44, as a replacement for pngtopnm. The
173 main improvement over pngtopnm was that it could generate a PAM image
174 with a transparency channel, whereas with pngtopnm, you would have to
175 extrac the transparency channel as a separate file, in a separate run.
176
177 pngtopnm was new in Netpbm 8.1 (March 2000), the first big change to
178 the package in Netpbm's renaissance. It and pnmtopng were simply
179 copied from the pnmtopng [22mpackage (1) by Greg Roelofs. Those were
180 based on simpler reference applications by by Alexander Lehmann
181 <alex@hal.rhein-main.de> and Willem van Schaik <willem@schaik.com> and
182 distributed with their PNG library.
183
184 Nearly all of the code has changed since it was copied from the pnm‐
185 topng package, most of it just to improve maintainability.
186
187
188
190 Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
191
192
193
194netpbm documentation 22 July 2008 Pngtopam User Manual(0)