1Pnmtopng User Manual(0) Pnmtopng User Manual(0)
2
3
4
6 pnmtopng - convert a PNM image to PNG
7
8
10 pnmtopng [-verbose] [-downscale] [-interlace] [-alpha=file] [-transpar‐
11 ent=[=]color] [-background=color] [-palette=palettefile] [-gamma=value]
12 [-hist] [-text=file] [-ztxt=file] [-rgb='wx wy
13 rx ry gx gy bx by'] [-size='x y unit'] [-modtime='[yy]yy-mm-dd
14 hh:mm:ss'] [-nofilter] [-sub] [-up] [-avg] [-paeth] [-compression=n]
15 [-comp_mem_level=n] [-comp_strategy={huffman_only|filtered}]
16 [-comp_method=deflated] [-comp_window_bits=n] [-comp_buffer_size=n]
17 [-force] [-libversion] [pnmfile]
18
19
20
22 Obsolete options:
23
24 [-filter n]
25
26 Options available only in older versions:
27
28 [-chroma wx wy rx ry gx gy bx by] [-phys x y unit] [-time [yy]yy-mm-dd
29 hh:mm:ss]
30
31 Minimum unique abbreviation of option is acceptable. You may use dou‐
32 ble hyphens instead of single hyphen to denote options. You may use
33 white space in place of the equals sign to separate an option name from
34 its value.
35
36
38 This program is part of Netpbm(1).
39
40 pnmtopng reads a PNM image as input and produces a PNG image as output.
41
42 Color values in PNG files are either eight or sixteen bits wide, so
43 pnmtopng will automatically scale colors to have a maxval of 255 or
44 65535. Grayscale files will be produced with bit depths 1, 2, 4, 8 or
45 16. An extra pamdepth step is not necessary.
46
47
49 pnmtopng changed in Netpbm 10.30 (October 2005) to use the standard
50 Netpbm command line syntax. Before that, you could not use double
51 hyphens to denote an option and could not use an equal sign to separate
52 an option name from its value. And the options had to come before the
53 non-option program arguments.
54
55 Furthermore, the options -chroma, -phys, and -time were replaced by
56 -rgb, size, and -modtime, respectively. The only difference, taking
57 -phys/-size as an example, is that -phys takes multiple program argu‐
58 ments as the option argument, whereas -rgb takes a single program argu‐
59 ment which is composed of multiple words. E.g. The old shell command
60
61 pnmtopng -phys 800 800 0 input.pnm >output.png
62
63 is equivalent to the new shell command
64
65 pnmtopng -size '800 800 0' input.pnm >output.png
66
67 If you're writing a program that needs to work with both new and old
68 pnmtopng, have it first try with the new syntax, and if it fails with
69 'unrecognized option,' fall back to the old syntax.
70
71
72
73 -verbose
74 Display the format of the output file.
75
76 -downscale
77 Enables scaling of maxvalues of more then 65535 to 16 bit.
78 Since
79 this means loss of image data, the step is not performed by
80 default.
81
82 -interlace
83 Creates an interlaced PNG file (Adam7).
84
85 -alpha=filename
86 This specifies the transparency (alpha channel) of the image.
87 You supply the alpha channel as a standard PGM alpha mask (see
88 the PGM(1)specification.pnmtopngdoesnot necessarily represents
89 the transparency information as an alpha channel in the PNG for‐
90 mat. If it can represent the transparency information through a
91 palette, it will do so in order to make a smaller PNG file.
92 pnmtopng even sorts the palette so it can omit the opaque colors
93 from the transparency part of the palette and save space for the
94 palette.
95
96
97 -transparent=color
98 pnmtopng marks the specified color as transparent in the PNG
99 image.
100
101 Specify the color (color) as described for the argument of the
102 ppm_parsecolor() library routine ⟨libppm.html#colorname⟩ . E.g.
103 red or rgb:ff/00/0d. If the color you specify is not present in
104 the image, pnmtopng selects instead the color in the image that
105 is closest to the one you specify. Closeness is measured as a
106 cartesian distance between colors in RGB space. If multiple
107 colors are equidistant, pnmtopng chooses one of them arbitrar‐
108 ily.
109
110 However, if you prefix your color specification with '=', e.g.
111
112 -transparent =red
113
114
115 only the exact color you specify will be transparent. If that
116 color does not appear in the image, there will be no trans‐
117 parency. pnmtopng issues an information message when this is
118 the case.
119
120
121 -background=color
122 Causes pnmtopng to create a background color chunk in the PNG
123 output which can be used for subsequent alpha channel or trans‐
124 parent color conversions. Specify color the same as for -trans‐
125 parent.
126
127
128 -palette=palettefile
129 This option specifies a palette to use in the PNG. It forces
130 pnmtopng to create the paletted (colormapped) variety of PNG --
131 if that isn't possible, pnmtopng fails. If the palette you
132 specify doesn't contain exactly the colors in the image, pnm‐
133 topng fails. Since pnmtopng will automatically generate a
134 paletted PNG, with a correct palette, when appropriate, the only
135 reason you would specify the -palette option is if you care in
136 what order the colors appear in the palette. The PNG palette
137 has colors in the same order as the palette you specify.
138
139 You specify the palette by naming a PPM file that has one pixel
140 for each color in the palette.
141
142 Alternatively, consider the case that have a palette and you
143 want to make sure your PNG contains only colors from the pal‐
144 ette, approximating if necessary. You don't care what indexes
145 the PNG uses internally for the colors (i.e. the order of the
146 PNG palette). In this case, you don't need -palette. Pass the
147 Netpbm input image and your palette PPM through pnmremap.
148 Though you might think it would, using -palette in this case
149 wouldn't even save pnmtopng any work.
150
151
152 -gamma=value
153 Causes pnmtopng to create a gAMA chunk. This information helps
154 describe how the color values in the PNG must be interpreted.
155 Without the gAMA chunk, whatever interprets the PNG must get
156 this information separately (or just assume something standard).
157 If your input is a true PPM or PGM image, you should specify
158 -gamma .45. But sometimes people generate images which are
159 ostensibly PPM except the image uses a different gamma transfer
160 function than the one specified for PPM. A common case of this
161 is when the image is created by simple hardware that doesn't
162 have digital computational ability. Also, some simple programs
163 that generate images from scratch do it with a gamma transfer in
164 which the gamma value is 1.0.
165
166
167 -hist Use this parameter to create a chunk that specifies the fre‐
168 quency (or histogram) of the colors in the image.
169
170
171 -rgb=chroma_list
172 This option specifies how red, green, and blue component values
173 of a pixel specify a particular color, by telling the chromatic‐
174 ities of those 3 primary illuminants and of white (i.e. full
175 strength of all three).
176
177 The chroma_list value is a blank-separated list of 8 floating
178 point decimal numbers. The CIE-1931 X and Y chromaticities (in
179 that order) of each of white, red, green, and blue, in that
180 order.
181
182 This information goes into the PNG's cHRM chunk.
183
184 In a shell command, make sure you use quotation marks so that
185 the blanks in chroma_list don't make the shell see multiple com‐
186 mand arguments.
187
188 This option was new in Netpbm 10.30 (October 2005). Before
189 that, the option -chroma does the same thing, but with slightly
190 different syntax.
191
192
193 -size='x y unit'
194 This option determines the aspect ratio of the individual pixels
195 of your image as well as the physical resolution of it.
196
197 unit is either 0 or 1. When it is 1, the option specifies the
198 physical resolution of the image in pixels per meter. For exam‐
199 ple, -size='10000 15000 1' means that when someone displays the
200 image, he should make it so that 10,000 pixels horizontally
201 occupy 1 meter and 15,000 pixels vertically occupy one meter.
202 And even if he doesn't take this advice on the overall size of
203 the displayed image, he should at least make it so that each
204 pixel displays as 1.5 times as high as wide.
205
206 When unit is 0, that means there is no advice on the absolute
207 physical resolution; just on the ratio of horizontal to vertical
208 physical resolution.
209
210 This information goes into the PNG's pHYS chunk.
211
212 When you don't specify -size, pnmtopng creates the image with no
213 pHYS chunk, which means square pixels of no absolute resolution.
214
215 This option was new in Netpbm 10.30 (October 2005). Before
216 that, the option -phys does the same thing, but with slightly
217 different syntax.
218
219
220 -text=filename
221 This option lets you include comments in the text chunk of the
222 PNG output. file is the name of a file that contains your text
223 comments.
224
225 Here is an example of a comment file:
226 Title PNG file
227
228 Author Bryan Henderson
229
230 Description how to include a text chunk
231 PNG file
232 "Creation date" 3-feb-1987
233
234 Software pnmtopng
235
236 The format of the file is as follows: The file is divided into
237 lines, delimited by newline characters. The last line need not
238 end with a newline character. A group of consecutive lines rep‐
239 resents a comment.
240
241 A "delimiter character" is a blank or tab or null character.
242 The first line representing a comment must not start with a
243 delimiter character. Every other line in the group is a "con‐
244 tinuation line" and must start with a delimiter character.
245
246 The first line representing a comment consists of a keyword and
247 the first line of comment text. The keyword begins in Column 1
248 of the file line and continues up to, but not including, the
249 first delimiter character, or the end of the line, whichever is
250 first. Exception: you can enclose the keyword in double quotes
251 and spaces and tabs within the double quotes are part of the
252 keyword. The quotes are not part of the keyword. A NUL charac‐
253 ter is not allowed in a keyword.
254
255 The first line of the comment text is all the text in the file
256 line beginning after the keyword and any delimiter characters
257 after it. immediately after the delimiter character that marks
258 the end of the keyword.
259
260 A continuation line defines a subsequent line of the comment.
261 The comment line is all the text on the continuation line start‐
262 ing with the first non-delimiter character.
263
264 There is one newline character between every two comment lines.
265 There is no newline character after the last line of comment
266 text.
267
268 There is no limit on the length of a file line or keyword or
269 comment text line or comment text. There is no limit on the
270 number of comments or size of or number of lines in the file.
271
272
273 -ztxt=filename
274 The same as -text, except pnmtopng considers the text com‐
275 pressed.
276
277
278 -modtime='[yy]yy-mm-dd hh:mm:ss'
279 This option allows you to specify the modification time value to
280 be placed in the PNG output. You can specify the year parameter
281 either as a two digit or four digit value.
282
283 This option was new in Netpbm 10.30 (October 2005). Before
284 that, the option -time does the same thing, but with slightly
285 different syntax.
286
287
288 -filter=n
289 This option is obsolete. Before Netpbm 10.22 (April 2004), this
290 was the only way to specify a row filter. It specifies a single
291 type of row filter, by number, that pnmtopng must use on each
292 row.
293
294 Use -nofilter, -sub, -up, -avg, and -paeth in current Netpbm.
295
296
297 -nofilter
298
299 -sub
300
301 -up
302
303 -avg
304
305 -paeth Each of these options permits pnmtopng to use one type of row
306 filter. pnmtopng chooses whichever of the permitted filters it
307 finds to be optimal. If you specify none of these options, it
308 is the same as specifying all of them -- pnmtopng uses any row
309 filter type it finds optimal.
310
311 These options were new with Netpbm 10.22 (April 2004). Before
312 that, you could use the -filter option to specify one permitted
313 row filter type. The default, when you specify no filter
314 options, was the same.
315
316
317 -compression=n
318 This option sets set the compression level of the zlib compres‐
319 sion. Select a level from 0 for no compression (maximum speed)
320 to 9 for maximum compression (minimum speed).
321
322
323 -comp_mem_level=n
324 This option sets the memory usage level of the zlib compression.
325 Select a level from 1 for minimum memory usage (and minimum
326 speed) to 9 for maximum memory usage (and speed).
327
328 This option was new in Netpbm 10.30 (October 2005).
329
330
331 -comp_strategy={huffman_only|filtered}
332 This options sets the compression strategy of the zlib compres‐
333 sion. See Zlib documentation for information on what these
334 strategies are.
335
336 This option was new in Netpbm 10.30 (October 2005).
337
338
339 -comp_method=deflated
340 This option does nothing. It is here for mathematical complete‐
341 ness and for possible forward compatibility. It theoretically
342 selects the compression method of the zlib compression, but the
343 Z library knows only one method today, so there's nothing to
344 choose.
345
346 This option was new in Netpbm 10.30 (October 2005).
347
348
349 -comp_window_bits=N
350 This option tells how big a window the zlib compression algo‐
351 rithm uses. The value is the base 2 logarithm of the window
352 size in bytes, so 8 means 256 bytes. The value must be from 8
353 to 15 (i.e. 256 bytes to 32K).
354
355 See Zlib documentation for details on what this window size is.
356
357 This option was new in Netpbm 10.30 (October 2005).
358
359
360 -comp_buffer_size=N
361 This option determines in what size pieces pnmtopng does the
362 zlib compression. One compressed piece goes in each IDAT chunk
363 in the PNG. So the bigger this value, the fewer IDAT chunks
364 your PNG will have. Theoretically, this makes the PNG smaller
365 because 1) you have less per-IDAT-chunk overhead, and 2) the
366 compression algorithm has more data to work with. But in real‐
367 ity, the difference will probably not be noticeable above about
368 8K, which is the default.
369
370 The value n is the size of the compressed piece (i.e. the com‐
371 pression buffer) in bytes.
372
373 This option was new in Netpbm 10.30 (October 2005).
374
375
376
377 -force When you specify this, pnmtopng limits its optimizations. The
378 resulting PNG output is as similar to the Netpbm input as possi‐
379 ble. For example, the PNG output will not be paletted and the
380 alpha channel will be represented as a full alpha channel even
381 if the information could be represented more succinctly with a
382 transparency chunk.
383
384
385
386 -libversion
387 This option causes pnmtopng to display version information about
388 itself and the libraries it uses, in addition to all its normal
389 function. Do not confuse this with the Netpbm common option
390 -version, which causes the program to display version informa‐
391 tion about the Netpbm library and do nothing else.
392
393 You can't really use this option in a program that invokes pnm‐
394 topng and needs to know which version it is. Its function has
395 changed too much over the history of pnmtopng. The option is
396 only good for human eyes.
397
398
399
400
402 pngtopnm(1), pamrgbatopng(1), pnmremap(1), pnmgamma(1), pnm(1)
403
404 For information on the PNG format, see http://schaik.com/png
405 ⟨http://schaik.com/png⟩ .
406
407
409 Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
410
411
412
413netpbm documentation June 2002 Pnmtopng User Manual(0)