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 transpar‐
57 ency information in the PNG. In contrast, handling of the alpha chan‐
58 nel 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 im‐
140 age.
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
155
156 -gamma=value
157 This causes pamtopng to create a gAMA chunk. This information
158 helps describe how the color values in the PNG must be inter‐
159 preted. Without the gAMA chunk, whatever interprets the PNG
160 must get this information separately (or just assume something
161 standard). If your input is a true PPM or PGM image, you should
162 specify -gamma=.45. But sometimes people generate images which
163 are ostensibly PPM except the image uses a different gamma
164 transfer function than the one specified for PPM. A common case
165 of this is when the image is created by simple hardware that
166 doesn't have digital computational ability. Also, some simple
167 programs that generate images from scratch do it with a gamma
168 transfer in which the gamma value is 1.0.
169
170
171
172
173 -chroma=chroma_list
174 This option specifies how red, green, and blue component values
175 of a pixel specify a particular color, by telling the chromatic‐
176 ities of those 3 primary illuminants and of white (i.e. full
177 strength of all three).
178
179 The chroma_list value is a blank-separated list of 8 floating
180 point decimal numbers. The CIE-1931 X and Y chromaticities (in
181 that order) of each of white, red, green, and blue, in that or‐
182 der.
183
184 This information goes into the PNG's cHRM chunk.
185
186 In a shell command, make sure you use quotation marks so that
187 the blanks in chroma_list don't make the shell see multiple com‐
188 mand arguments.
189
190
191 -srgbintent=intent
192 This asserts that the input is a pseudo-Netpbm image that uses
193 an sRGB color space (unlike true Netpbm) and indicates how you
194 intend for the colors to be rendered. It causes pamtopng to in‐
195 clude an sRGB chunk in the PNG image that specifies that intent,
196 so see the PNG documentation for more information on what this
197 really means.
198
199 intent is one of:
200
201
202
203 • perceptual
204
205 • relativecolorimetric
206
207 • saturation
208
209 • absolutecolorimetric
210
211
212
213 -text=filename
214 This option lets you include arbitrary text strings in the PNG
215 output, as tEXt chunks.
216
217 filename is the name of a file that contains your text strings.
218
219 The output contains a distinct tEXt chunk for each entry in the
220 file.
221
222 Here is an example of a text string file:
223
224 Title PNG file
225 Author John Doe
226 Description how to include a text chunk
227 PNG file
228 "Creation Date" 2015-may-11
229 Software pamtopng
230
231 The file is divided into entries, each entry comprising consecu‐
232 tive lines of text. The first line of an entry starts in the
233 first column (i.e. the first column is not white space) and ev‐
234 ery other line has white space in the first column. The first
235 entry starts in the first line, so it is not valid for the first
236 line of the file to have white space in its first column.
237
238 The first word in an entry is the key of the text string (e.g.
239 'Title'). It begins in column one of the line and continues up
240 to, but not including, the first delimiter character or the end
241 of the line, whichever is first. You can enclose the key in
242 double quotes in which case the key can consists of multiple
243 words. The quotes are not part of the key. The text string per
244 se begins after the key and any delimiter characters after it,
245 plus the text in subsequent continuation lines.
246
247 There is no limit on the length of a file line or entry or key
248 or text string. There is no limit on the number of entries.
249
250
251 -ztxt=filename
252 The same as -text, except the text string is compressed in the
253 PNG output. pamtopng uses zTXt chunks instead of a tEXt chunks.
254
255
256
257
258 -itxt=filename
259 Similar to -text, but the text strings can be in a language
260 other than English. The PNG image indicates what language that
261 is and includes the text string key both in English and that
262 language. pamtopng uses iTXt chunks instead of tEXt chunks.
263
264 For each record, you must specify the language and give the key
265 both in English and in the text string language.
266
267 Example:
268
269 Language nl-NL Taal nl-NL
270 Title nl-NL Titel PNG file
271 Author nl-NL Auteur Pietje Puk
272 Description nl-NL Omschrijving Tekst in het Nederlands.
273
274 The language specification is based on the ISO 639-1 standard,
275 see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the
276 valid codes. The format is either a two character "nl" or an
277 extended code like "en-US".
278
279
280 -time='[yy]yy-mm-dd hh:mm:ss'
281 This option allows you to specify the modification time value to
282 be placed in the PNG output. You can specify the year parameter
283 either as a two or four digit value.
284
285
286
287
288 -interlace
289 This causes the PNG file to be interlaced, in Adam7 format. The
290 interlaced format is one in which the raster data starts with a
291 low-resolution representation of the entire image, then contin‐
292 ues with additional information for the entire image, then even
293 more information, etc. In Adam7 in particular, there are seven
294 such passes of the whole image. This is useful when you are re‐
295 ceiving the image over a slow communication line as someone is
296 waiting to see it. The simplest thing to do in that case is
297 wait for the entire image to arrive and then display it in‐
298 stantly, but then the user is wasting time staring at a blank
299 space until the whole image arrives. With the standard non-in‐
300 terlaced format, the data arrives row-by-row starting at the
301 top, so the displayer could display each row of the image as it
302 arrives and gradually paint down to the bottom. But with an in‐
303 terlaced image, the displayer can start by showing a low-resolu‐
304 tion version of the image, then gradually improve the display as
305 more data arrives.
306
307 When you specify this option, pamtopng must hold the entire im‐
308 age in memory at once, whereas without it, the program holds
309 only one raster row at a time. If you don't have enough memory
310 for that, you might suffer extreme slowdowns or failure - not
311 just in the process running pamtopng, but potentially throughout
312 the system that shares memory with it. pnmtopng does not have
313 this limitation (it holds only one row at a time in memory even
314 when generating an interlaced PNG).
315
316 This option was new in Netpbm 10.86 (March 2019).
317
318
319 -verbose
320 This causes the program to display various facts about the con‐
321 version.
322
323
324
325
326
327
328
330 pngtopam(1), pnmtopng(1), pam(1), pnm(1)
331
332 For information on the PNG format, see http://www.w3.org/TR/PNG/
333 ⟨http://www.w3.org/TR/PNG/⟩ , http://libpng.org/pub/png/
334 ⟨http://libpng.org/pub/png/⟩ ,
335 http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
336 ⟨http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes⟩ and
337 http://schaik.com/png/ ⟨http://schaik.com/png/⟩ .
338
339
341 pamtopng was new in Netpbm 10.70 (June 2015).
342
343 Before pamtopng, the two ways to create PNG images with Netpbm were pn‐
344 mtopng and pamrgbatopng. The history of the former is discussed above.
345 The latter was added to Netpbm in 2005 as a cheap way to fill a signif‐
346 icant need that pnmtopng did not: the ability to turn the alpha channel
347 in a PAM image into the alpha channel in a PNG image.
348
349 Handling of the alpha channel with pnmtopng is very cumbersome (as was
350 dealing with alpha channels in general before the introduction of the
351 PAM format). pamrgbatopng could do what people wanted with the alpha
352 channel, but nothing else. It was a very small program with literally
353 no command line options.
354
355 The goal in those days was eventually to expand pnmtopng to do the PAM
356 alpha channel thing, rename it to pamtopng, and retire pamrgbatopng.
357 But pnmtopng is such a complex program, because of its dizzying array
358 of features and its need for backward compatibility, that adding that
359 one capability to it was a daunting task and for ten years nobody at‐
360 tempted it.
361
362 In 2015, one of the authors of the original pnmtopng (from before it
363 was even part of Netpbm -- a program that shared essentially no lines
364 of code with pnmtopng of 2015) decided to go in a different direction.
365 While many features of pnmtopng were pretty important and easy to im‐
366 plement, many others were probably of no use in the modern world or at
367 least not important enough to justify the complexity they lent to the
368 code. (The features thought to be outdated were ones that were in‐
369 tended to make the PNG output slightly smaller - something considerably
370 less important with the declining cost of computer resources).
371
372 And there was an opportunity to drop those features: We could use the
373 new name 'pamtopng' for a new program, keep the existing program under
374 the name 'pnmtopng', and avoid most backward compatibility trouble.
375
376 Therefore, Willem van Schaik wrote an intermediate level program that
377 had all the most important features of pnmtopng, plus the alpha channel
378 handling of pamrgbatopng, with nice, simple code. That was pamtopng.
379
380 Because pamrgbatopng had no options, pamtopng was backward compatible
381 with it without even trying. Therefore, as soon as we added pamtopng
382 to Netpbm, we removed pamrgbatopng and recommended that pamrgbatopng be
383 installed as an alias for pamtopng.
384
385
386
388 Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
389 Copyright (C) 2015 by Willem van Schaik.
390
392 This manual page was generated by the Netpbm tool 'makeman' from HTML
393 source. The master documentation is at
394
395 http://netpbm.sourceforge.net/doc/pamtopng.html
396
397netpbm documentation 13 March 2019 Pamtopng User Manual(0)