1Pamtopng User Manual(0) Pamtopng User Manual(0)
2
3
4
6 pamtopng - convert a Netpbm image to PNG
7
8
10 pamtopng [-verbose] [-transparent=color] [-background=color]
11 [-gamma=value] [-chroma='wx wy
12 rx ry gx gy bx by'] [-srgbintent=intent] [-time=[yy]yy-mm-dd
13 hh:mm:ss] [-text=file] [-ztxt=file] [-itxt=file] [-interlace] [pnm‐
14 file]
15
16
18 Minimum unique abbreviation of option is acceptable. You may use dou‐
19 ble hyphens instead of a single hyphen to denote options. You may use
20 white space in place of the equals sign to separate an option name from
21 its value.
22
23
25 This program is part of Netpbm(1).
26
27 pamtopng reads a Netpbm image as input and produces a PNG image as out‐
28 put.
29
30 Color component values in PNG files are either 8 or 16 bits wide, so
31 where necessary pamtopng scales colors to have a maxval of 255 or
32 65535. In that case, it will add an sBIT chunk to indicated the origi‐
33 nal bit-depth.
34
35 pamtopng works only on images with maxval 1, 3, 15, 255, or 65535. You
36 can use pamdepth to convert an image with some other maxval to one of
37 these.
38
39 pamtopng produces a color PNG from a color PAM, even if the only colors
40 in the image are shades of gray. To create a graycale PNG, from such
41 an image (which might be slightly smaller), you can use other Netpbm
42 programs to convert the input to grayscale.
43
44
45 Alternative: pnmtopng
46 Netpbm contains another program for generating PNG images: pnmtopng.
47 pnmtopng is a much older program - it is in fact the first program in
48 the world that could generate a PNG. pnmtopng is a complex, feature-
49 laden program. It lets you control various arcane aspects of the con‐
50 version and create PNGs with various arcane features. It does various
51 transformations on the image to create the greatest compression possi‐
52 ble, to a degree that probably doesn't make any difference in the mod‐
53 ern world.
54
55 The main advantage pamtopng has over pnmtopng is that the former can
56 use the transparency channel of a PAM image to generate the trans‐
57 parency information in the PNG. In contrast, handling of the alpha
58 channel is very cumbersome with pnmotpng.
59
60 One difference that does not exist, that some people might incorrectly
61 infer from the names is the possible input formats. Both programs can
62 take PBM, PGM, PPM, and PAM input.
63
64 Because pnmtopng has been around virtually forever, programs and proce‐
65 dures that use it are more portable than those that use pamtopng. Its
66 age and popularity also probably make it have fewer bugs.
67
68 pamtopng does not have any way to do what the following do in pnmtopng:
69
70
71
72 · -palette
73
74 · -history
75
76 · -filter
77
78 · -size
79
80 · -paeth
81
82 · -hist
83
84 · -nofilter
85
86 · -sub
87
88 · -up
89
90 · -avg
91
92 · -force
93
94 · -libversion
95
96 · -compression
97
98 · -comp_xxx
99
100
101 These are some of the other functions of pnmtopng that pamtopng lacks:
102
103
104
105 · When you specify a transparent or background color that is not
106 in the image, pnmtopng can optionally choose the closest one
107 that is in the image. pamtopng always uses the exact color you
108 specify.
109
110
111 Features that exist in both programs are controlled by largely the same
112 command syntax. But there are these differences:
113
114
115
116 · pnmtopng's -rgb option is -chroma in pamtopng. -chroma is a
117 better name, and in fact was the name that pnmtopng used origi‐
118 nally, but we had to change it when we had to change the syntax
119 of the option value to conform to the rest of Netpbm.
120
121
122 · pnmtopng's -modtime option is -time in pamtopng. The origin of
123 -modtime is analogous to that of -rgb.
124
125
126
127
128
130 In addition to the options common to all programs based on libnetpbm
131 (most notably -quiet, see
132 Common Options ⟨index.html#commonoptions⟩ ), pamtopng recognizes the
133 following command line options:
134
135
136
137
138 -transparent=color
139 pamtopng marks the specified color as transparent in the PNG
140 image.
141
142 Specify the color (color) as described for the argument of the
143 pnm_parsecolor() library routine
144 ⟨libnetpbm_image.html#colorname⟩ . E.g. red or rgb:ff/00/0d.
145
146
147 -background=color
148 This causes pamtopng to create a background color chunk in the
149 PNG output which can be used for subsequent transparency channel
150 or transparent color conversions. Specify color the same as for
151 -transparent.
152
153
154 -gamma=value
155 This causes pamtopng to create a gAMA chunk. This information
156 helps describe how the color values in the PNG must be inter‐
157 preted. Without the gAMA chunk, whatever interprets the PNG
158 must get this information separately (or just assume something
159 standard). If your input is a true PPM or PGM image, you should
160 specify -gamma=.45. But sometimes people generate images which
161 are ostensibly PPM except the image uses a different gamma
162 transfer function than the one specified for PPM. A common case
163 of this is when the image is created by simple hardware that
164 doesn't have digital computational ability. Also, some simple
165 programs that generate images from scratch do it with a gamma
166 transfer in which the gamma value is 1.0.
167
168
169
170 -chroma=chroma_list
171 This option specifies how red, green, and blue component values
172 of a pixel specify a particular color, by telling the chromatic‐
173 ities of those 3 primary illuminants and of white (i.e. full
174 strength of all three).
175
176 The chroma_list value is a blank-separated list of 8 floating
177 point decimal numbers. The CIE-1931 X and Y chromaticities (in
178 that order) of each of white, red, green, and blue, in that
179 order.
180
181 This information goes into the PNG's cHRM chunk.
182
183 In a shell command, make sure you use quotation marks so that
184 the blanks in chroma_list don't make the shell see multiple com‐
185 mand arguments.
186
187
188 -srgbintent=intent
189 This asserts that the input is a pseudo-Netpbm image that uses
190 an sRGB color space (unlike true Netpbm) and indicates how you
191 intend for the colors to be rendered. It causes pamtopng to
192 include an sRGB chunk in the PNG image that specifies that
193 intent, so see the PNG documentation for more information on
194 what this really means.
195
196 intent is one of:
197
198
199
200 · perceptual
201
202 · relativecolorimetric
203
204 · saturation
205
206 · absolutecolorimetric
207
208
209
210 -text=filename
211 This option lets you include arbitrary text strings in the PNG
212 output, as tEXt chunks.
213
214 filename is the name of a file that contains your text strings.
215
216 The output contains a distinct tEXt chunk for each entry in the
217 file.
218
219 Here is an example of a text string file:
220
221 Title PNG file
222 Author John Doe
223 Description how to include a text chunk
224 PNG file
225 "Creation Date" 2015-may-11
226 Software pamtopng
227
228 The file is divided into entries, each entry comprising consecu‐
229 tive lines of text. The first line of an entry starts in the
230 first column (i.e. the first column is not white space) and
231 every other line has white space in the first column. The first
232 entry starts in the first line, so it is not valid for the first
233 line of the file to have white space in its first column.
234
235 The first word in an entry is the key of the text string (e.g.
236 'Title'). It begins in column one of the line and continues up
237 to, but not including, the first delimiter character or the end
238 of the line, whichever is first. You can enclose the key in
239 double quotes in which case the key can consists of multiple
240 words. The quotes are not part of the key. The text string per
241 se begins after the key and any delimiter characters after it,
242 plus the text in subsequent continuation lines.
243
244 There is no limit on the length of a file line or entry or key
245 or text string. There is no limit on the number of entries.
246
247
248 -ztxt=filename
249 The same as -text, except the text string is compressed in the
250 PNG output. pamtopng uses zTXt chunks instead of a tEXt chunks.
251
252
253 -itxt=filename
254 Similar to -text, but the text strings can be in a language
255 other than English. The PNG image indicates what language that
256 is and includes the text string key both in English and that
257 language. pamtopng uses iTXt chunks instead of tEXt chunks.
258
259 For each record, you must specify the language and give the key
260 both in English and in the text string language.
261
262 Example:
263
264 Language nl-NL Taal nl-NL
265 Title nl-NL Titel PNG file
266 Author nl-NL Auteur Pietje Puk
267 Description nl-NL Omschrijving Tekst in het Nederlands.
268
269 The language specification is based on the ISO 639-1 standard,
270 see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the
271 valid codes. The format is either a two character "nl" or an
272 extended code like "en-US".
273
274
275 -time='[yy]yy-mm-dd hh:mm:ss'
276 This option allows you to specify the modification time value to
277 be placed in the PNG output. You can specify the year parameter
278 either as a two or four digit value.
279
280
281
282 -interlace
283 This causes the PNG file to be interlaced, in Adam7 format. The
284 interlaced format is one in which the raster data starts with a
285 low-resolution representation of the entire image, then contin‐
286 ues with additional information for the entire image, then even
287 more information, etc. In Adam7 in particular, there are seven
288 such passes of the whole image. This is useful when you are
289 receiving the image over a slow communication line as someone is
290 waiting to see it. The simplest thing to do in that case is
291 wait for the entire image to arrive and then display it
292 instantly, but then the user is wasting time staring at a blank
293 space until the whole image arrives. With the standard non-
294 interlaced format, the data arrives row-by-row starting at the
295 top, so the displayer could display each row of the image as it
296 arrives and gradually paint down to the bottom. But with an
297 interlaced image, the displayer can start by showing a low-reso‐
298 lution version of the image, then gradually improve the display
299 as more data arrives.
300
301 When you specify this option, pamtopng must hold the entire
302 image in memory at once, whereas without it, the program holds
303 only one raster row at a time. If you don't have enough memory
304 for that, you might suffer extreme slowdowns or failure - not
305 just in the process running pamtopng, but potentially throughout
306 the system that shares memory with it. pnmtopng does not have
307 this limitation (it holds only one row at a time in memory even
308 when generating an interlaced PNG).
309
310 This option was new in Netpbm 10.86 (March 2019).
311
312
313 -verbose
314 This causes the program to display various facts about the con‐
315 version.
316
317
318
319
320
322 pngtopam(1), pnmtopng(1), pam(1), pnm(1)
323
324 For information on the PNG format, see http://www.w3.org/TR/PNG/
325 ⟨http://www.w3.org/TR/PNG/⟩ , http://libpng.org/pub/png/
326 ⟨http://libpng.org/pub/png/⟩ ,
327 http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
328 ⟨http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes⟩ and
329 http://schaik.com/png/ ⟨http://schaik.com/png/⟩ .
330
331
333 pamtopng was new in Netpbm 10.70 (June 2015).
334
335 Before pamtopng, the two ways to create PNG images with Netpbm were
336 pnmtopng and pamrgbatopng. The history of the former is discussed
337 above. The latter was added to Netpbm in 2005 as a cheap way to fill a
338 significant need that pnmtopng did not: the ability to turn the alpha
339 channel in a PAM image into the alpha channel in a PNG image.
340
341 Handling of the alpha channel with pnmtopng is very cumbersome (as was
342 dealing with alpha channels in general before the introduction of the
343 PAM format). pamrgbatopng could do what people wanted with the alpha
344 channel, but nothing else. It was a very small program with literally
345 no command line options.
346
347 The goal in those days was eventually to expand pnmtopng to do the PAM
348 alpha channel thing, rename it to pamtopng, and retire pamrgbatopng.
349 But pnmtopng is such a complex program, because of its dizzying array
350 of features and its need for backward compatibility, that adding that
351 one capability to it was a daunting task and for ten years nobody
352 attempted it.
353
354 In 2015, one of the authors of the original pnmtopng (from before it
355 was even part of Netpbm -- a program that shared essentially no lines
356 of code with pnmtopng of 2015) decided to go in a different direction.
357 While many features of pnmtopng were pretty important and easy to
358 implement, many others were probably of no use in the modern world or
359 at least not important enough to justify the complexity they lent to
360 the code. (The features thought to be outdated were ones that were
361 intended to make the PNG output slightly smaller - something consider‐
362 ably less important with the declining cost of computer resources).
363
364 And there was an opportunity to drop those features: We could use the
365 new name 'pamtopng' for a new program, keep the existing program under
366 the name 'pnmtopng', and avoid most backward compatibility trouble.
367
368 Therefore, Willem van Schaik wrote an intermediate level program that
369 had all the most important features of pnmtopng, plus the alpha channel
370 handling of pamrgbatopng, with nice, simple code. That was pamtopng.
371
372 Because pamrgbatopng had no options, pamtopng was backward compatible
373 with it without even trying. Therefore, as soon as we added pamtopng
374 to Netpbm, we removed pamrgbatopng and recommended that pamrgbatopng be
375 installed as an alias for pamtopng.
376
377
378
380 Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
381 Copyright (C) 2015 by Willem van Schaik.
382
384 This manual page was generated by the Netpbm tool 'makeman' from HTML
385 source. The master documentation is at
386
387 http://netpbm.sourceforge.net/doc/pamtopng.html
388
389netpbm documentation 13 March 2019 Pamtopng User Manual(0)