1Pnmtopng User Manual(0)                                Pnmtopng User Manual(0)
2
3
4

NAME

6       pnmtopng - convert a PNM image to PNG
7
8

SYNOPSIS

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'] [-srgbintent=intent] [-mod‐
14       time='[yy]yy-mm-dd
15         hh:mm:ss'] [-nofilter] [-sub] [-up] [-avg] [-paeth]  [-compression=n]
16       [-comp_mem_level=n]            [-comp_strategy={huffman_only|filtered}]
17       [-comp_method=deflated]   [-comp_window_bits=n]   [-comp_buffer_size=n]
18       [-force] [-libversion] [pnmfile]
19
20
21

OPTION USAGE

23       Obsolete options:
24
25       [-filter n]
26
27       Options available only in older versions:
28
29       [-chroma wx wy rx ry gx gy bx by] [-phys x y unit] [-time [yy]yy-mm-dd
30         hh:mm:ss]
31
32       Minimum  unique abbreviation of option is acceptable.  You may use dou‐
33       ble hyphens instead of single hyphen to denote options.   You  may  use
34       white space in place of the equals sign to separate an option name from
35       its value.
36
37

DESCRIPTION

39       This program is part of Netpbm(1).
40
41       pnmtopng reads a PNM image as input and produces a PNG image as output.
42
43       Color component values in PNG files are either eight  or  sixteen  bits
44       wide,  so  pnmtopng will automatically scale colors to have a maxval of
45       255 or 65535.
46
47       For a grayscale image, pnmtopng produces a PNG bit depth 1, 2, 4, 8  or
48       16.   When the input image has a small maxval, the output PNG image has
49       a correspondingly small bit depth.  But in mapping the  PNM  maxval  to
50       the  PNG  maxval  (which is by definition the maximum value that can be
51       represented in the number of bits), a fair amount of distortion happens
52       with  these low maxvals.  For example, with a PNM maxval of 5 and a PNG
53       maxval of 7, the input sample 2 becomes the output sample 3.  The input
54       brightness  is  2/5  =  .40,  while the output brightness is 3/7 = .43.
55       Note that this is not a problem if you view the maxval as a  precision,
56       because  in  .4  and  .43 are identical within the precision implied by
57       maxval 5.  Indeed, if you convert this PNG back to a maxval 5 PGM,  the
58       pixel's  value  will  again be 2, exactly as it was originally.  But if
59       you need precisely the same colors in the output PNG as  in  the  input
60       PNM,  make sure your input PNM has a maxval which is a power of two mi‐
61       nus one.  If you can't do that, then convert it with pamdepth to  some‐
62       thing  with  a  large  maxval that is a power of two minus one (255 and
63       65535 are good choices) to minimize the error.
64
65
66

OPTIONS

68   Note: Option Syntax of Older Versions
69       pnmtopng changed in Netpbm 10.30 (October 2005)  to  use  the  standard
70       Netpbm  command line syntax.  Before that, you could not use double hy‐
71       phens to denote an option and could not use an equal sign  to  separate
72       an  option name from its value.  And the options had to come before the
73       non-option program arguments.
74
75       Furthermore, the options -chroma, -phys, and  -time  were  replaced  by
76       -rgb,  -size,  and -modtime, respectively.  The only difference, taking
77       -phys/-size as an example, is that -phys takes multiple  program  argu‐
78       ments  as the option argument, whereas -size takes a single program ar‐
79       gument which is composed of multiple words.  E.g.  The old  shell  com‐
80       mand
81
82          pnmtopng -phys 800 800 0 input.pnm > output.png
83
84       is equivalent to the new shell command
85
86          pnmtopng -size "800 800 0" input.pnm > output.png
87
88       If  you're writing a program that needs to work with both new and old ,
89       have it first try with the new syntax, and if it fails  with  "unrecog‐
90       nized option," fall back to the old syntax.
91
92
93   Current Options
94       In  addition  to  the options common to all programs based on libnetpbm
95       (most notably -quiet, see
96        Common Options ⟨index.html#commonoptions⟩ ), pnmtopng  recognizes  the
97       following command line options:
98
99
100
101       -verbose
102              This  causes pnmtopng to display information about the format of
103              the output file.
104
105
106
107
108       -downscale
109              This enables pnmtopng to scale maxvalues of more then  65535  to
110              16  bits. Since this means loss of image data, pnmtopng does not
111              do it by default.
112
113
114
115
116       -interlace
117              This causes the PNG file to be interlaced, in Adam7 format.  The
118              interlaced  format is one in which the raster data starts with a
119              low-resolution representation of the entire image, then  contin‐
120              ues  with additional information for the entire image, then even
121              more information, etc.  In Adam7 in particular, there are  seven
122              such passes of the whole image.  This is useful when you are re‐
123              ceiving the image over a slow communication line as  someone  is
124              waiting  to  see  it.   The simplest thing to do in that case is
125              wait for the entire image to arrive  and  then  display  it  in‐
126              stantly,  but  then  the user is wasting time staring at a blank
127              space until the whole image arrives.  With the standard  non-in‐
128              terlaced  format,  the  data  arrives row-by-row starting at the
129              top, so the displayer could display each row of the image as  it
130              arrives and gradually paint down to the bottom.  But with an in‐
131              terlaced image, the displayer can start by showing a low-resolu‐
132              tion version of the image, then gradually improve the display as
133              more data arrives.
134
135
136
137
138       -alpha=filename
139              This specifies the transparency (alpha) channel  of  the  image.
140              You  supply the transparency channel as a standard PGM transpar‐
141              ency mask (see the PGM(1) specification.  pnmtopng does not nec‐
142              essarily  represents the transparency information as a transpar‐
143              ency channel in the PNG format.  If it can represent the  trans‐
144              parency information through a palette, it will do so in order to
145              make a smaller PNG file.  pnmtopng even sorts the palette so  it
146              can  omit  the  opaque  colors from the transparency part of the
147              palette and save space for the palette.
148
149
150
151
152       -transparent=color
153              pnmtopng marks the specified color as transparent in the PNG im‐
154              age.
155
156              Specify  the  color (color) as described for the argument of the
157              pnm_parsecolor()                 library                 routine
158              ⟨libnetpbm_image.html#colorname⟩  .   E.g.  red or rgb:ff/00/0d.
159              If the color you specify is not present in the  image,  pnmtopng
160              selects  instead  the  color in the image that is closest to the
161              one you specify.  Closeness is measured as a Cartesian  distance
162              between  colors  in  RGB space.  If multiple colors are equidis‐
163              tant, pnmtopng chooses one of them arbitrarily.
164
165              However, if you prefix your color specification with "=", e.g.
166
167                                  -transparent =red
168
169               only the exact color you specify will be transparent.  If  that
170              color  does  not appear in the image, there will be no transpar‐
171              ency.  pnmtopng issues an information message when this  is  the
172              case.
173
174
175       -background=color
176              Causes  pnmtopng  to  create a background color chunk in the PNG
177              output which can be used for subsequent transparency channel  or
178              transparent  color  conversions.   Specify color the same as for
179              -transparent.
180
181
182
183
184       -palette=palettefile
185              This option specifies a palette to use in the  PNG.   It  forces
186              pnmtopng  to create the paletted (colormapped) variety of PNG --
187              if that isn't possible, pnmtopng  fails.   If  the  palette  you
188              specify  doesn't  contain  exactly the colors in the image, pnm‐
189              topng fails.   Since  pnmtopng  will  automatically  generate  a
190              paletted PNG, with a correct palette, when appropriate, the only
191              reason you would specify the -palette option is if you  care  in
192              what  order  the  colors appear in the palette.  The PNG palette
193              has colors in the same order as the palette you specify.
194
195              You specify the palette by naming a PPM file that has one  pixel
196              for each color in the palette.
197
198              Alternatively,  consider  the  case  that have a palette and you
199              want to make sure your PNG contains only colors  from  the  pal‐
200              ette,  approximating  if necessary.  You don't care what indexes
201              the PNG uses internally for the colors (i.e. the  order  of  the
202              PNG  palette).  In this case, you don't need -palette.  Pass the
203              Netpbm input  image  and  your  palette  PPM  through  pnmremap.
204              Though  you  might  think  it would, using -palette in this case
205              wouldn't even save pnmtopng any work.
206
207
208       -gamma=value
209              Causes pnmtopng to create a gAMA chunk.  This information  helps
210              describe  how  the  color values in the PNG must be interpreted.
211              Without the gAMA chunk, whatever interprets  the  PNG  must  get
212              this information separately (or just assume something standard).
213              If your input is a true PPM or PGM  image,  you  should  specify
214              -gamma=.52.   But sometimes people generate images which are os‐
215              tensibly PPM except the image uses a  different  gamma  transfer
216              function  than the one specified for PPM.  A common case of this
217              is when the image is created by  simple  hardware  that  doesn't
218              have  digital computational ability.  Also, some simple programs
219              that generate images from scratch do it with a gamma transfer in
220              which the gamma value is 1.0.
221
222
223
224
225       -hist  Use  this  parameter  to  create a chunk that specifies the fre‐
226              quency (or histogram) of the colors in the image.
227
228
229
230
231       -text=filename
232              This option lets you include arbitrary text strings in  the  PNG
233              output, as tEXt chunks.
234
235              filename is the name of a file that contains your text strings.
236
237              The  output contains a distinct tEXt chunk for each entry in the
238              file.
239
240              Here is an example of a text string file:
241
242                   Title           PNG file
243                   Author          John Doe
244                   Description     how to include a text chunk
245                                      PNG file
246                   "Creation Date" 2015-may-11
247                   Software        pamtopng
248
249              The file is divided into entries, each entry comprising consecu‐
250              tive  lines  of  text.  The first line of an entry starts in the
251              first column (i.e. the first column is not white space) and  ev‐
252              ery  other  line has white space in the first column.  The first
253              entry starts in the first line, so it is not valid for the first
254              line of the file to have white space in its first column.
255
256              The  first  word in an entry is the key of the text string (e.g.
257              'Title').  It begins in column one of the line and continues  up
258              to,  but not including, the first delimiter character or the end
259              of the line, whichever is first.  You can  enclose  the  key  in
260              double  quotes  in  which  case the key can consists of multiple
261              words.  The quotes are not part of the key.  The text string per
262              se  begins  after the key and any delimiter characters after it,
263              plus the text in subsequent continuation lines.
264
265              There is no limit on the length of a file line or entry  or  key
266              or text string.  There is no limit on the number of entries.
267
268
269       -ztxt=filename
270              The  same  as -text, except the text string is compressed in the
271              PNG output.  pnmtopng uses zTXt chunks instead of a tEXt chunks,
272              unless the key for the text string starts with 'A' or 'T'.  This
273              odd exception exists for backward compatibility; we  don't  know
274              why  the  program  was originally designed this way, except that
275              the distinction was meant to roughly identify the keys  'Author'
276              and 'Title'.
277
278
279
280
281       -rgb=chroma_list
282              This  option specifies how red, green, and blue component values
283              of a pixel specify a particular color, by telling the chromatic‐
284              ities  of  those  3  primary illuminants and of white (i.e. full
285              strength of all three).
286
287              The chroma_list value is a blank-separated list  of  8  floating
288              point  decimal numbers.  The CIE-1931 X and Y chromaticities (in
289              that order) of each of white, red, green, and blue, in that  or‐
290              der.
291
292              This information goes into the PNG's cHRM chunk.
293
294              In  a  shell  command, make sure you use quotation marks so that
295              the blanks in chroma_list don't make the shell see multiple com‐
296              mand arguments.
297
298              This  option  was  new  in  Netpbm 10.30 (October 2005).  Before
299              that, the option -chroma does the same thing, but with  slightly
300              different syntax.
301
302
303       -size="x y unit"
304              This option determines the aspect ratio of the individual pixels
305              of your image as well as the physical resolution of it.
306
307              unit is either 0 or 1.  When it is 1, the option  specifies  the
308              physical resolution of the image in pixels per meter.  For exam‐
309              ple, -size="10000 15000 1" means that when someone displays  the
310              image,  he should make it so that 10,000 pixels horizontally oc‐
311              cupy 1 meter and 15,000 pixels vertically occupy one meter.  And
312              even  if  he doesn't take this advice on the overall size of the
313              displayed image, he should at least make it so that  each  pixel
314              displays as 1.5 times as high as wide.
315
316              When  unit  is  0, that means there is no advice on the absolute
317              physical resolution; just on the ratio of horizontal to vertical
318              physical resolution.
319
320              This information goes into the PNG's pHYS chunk.
321
322              When you don't specify -size, pnmtopng creates the image with no
323              pHYS chunk, which means square pixels of no absolute resolution.
324
325              This option was new in  Netpbm  10.30  (October  2005).   Before
326              that,  the  option  -phys does the same thing, but with slightly
327              different syntax.
328
329
330       -srgbintent=intent
331              This asserts that the input is a pseudo-Netpbm image  that  uses
332              an  sRGB  color space (unlike true Netpbm) and indicates how you
333              intend for the colors to be rendered.  It causes pnmtopng to in‐
334              clude an sRGB chunk in the PNG image that specifies that intent,
335              so see the PNG documentation for more information on  what  this
336              really means.
337
338              intent is one of:
339
340
341
342perceptual
343
344relativecolorimetric
345
346saturation
347
348absolutecolorimetric
349
350
351              This  option  was new in Netpbm 10.71 (June 2015).  Before that,
352              pnmtopng never generates an sRGB chunk.
353
354
355       -modtime="[yy]yy-mm-dd hh:mm:ss"
356              This option allows you to specify the modification time value to
357              be placed in the PNG output.  You can specify the year parameter
358              either as a two digit or four digit value.
359
360              This option was new in  Netpbm  10.30  (October  2005).   Before
361              that,  the  option  -time does the same thing, but with slightly
362              different syntax.
363
364
365       -filter=n
366              This option is obsolete.  Before Netpbm 10.22 (April 2004), this
367              was the only way to specify a row filter.  It specifies a single
368              type of row filter, by number, that pnmtopng must  use  on  each
369              row.
370
371              Use -nofilter, -sub, -up, -avg, and -paeth in current Netpbm.
372
373
374       -nofilter
375
376       -sub
377
378       -up
379
380       -avg
381
382       -paeth Each  of  these  options permits pnmtopng to use one type of row
383              filter.  pnmtopng chooses whichever of the permitted filters  it
384              finds  to  be optimal.  If you specify none of these options, it
385              is the same as specifying all of them -- pnmtopng uses  any  row
386              filter type it finds optimal.
387
388              These  options  were new with Netpbm 10.22 (April 2004).  Before
389              that, you could use the -filter option to specify one  permitted
390              row  filter  type.   The default, when you specify no filter op‐
391              tions, was the same.
392
393
394       -compression=n
395              This option sets set the compression level of the zlib  compres‐
396              sion.   Select a level from 0 for no compression (maximum speed)
397              to 9 for maximum compression (minimum speed).
398
399              The default is the default of the zlib library.
400
401
402       -comp_mem_level=n
403              This option sets the memory usage level of the zlib compression.
404              Select  a  level  from  1  for minimum memory usage (and minimum
405              speed) to 9 for maximum memory usage (and speed).
406
407              The default is the default of the zlib library.
408
409              This option was new in Netpbm 10.30 (October 2005).
410
411
412       -comp_strategy={huffman_only|filtered}
413              This options sets the compression strategy of the zlib  compres‐
414              sion.   See  Zlib  documentation  for  information on what these
415              strategies are.
416
417              The default is the default of the zlib library.
418
419              This option was new in Netpbm 10.30 (October 2005).
420
421
422       -comp_method=deflated
423              This option does nothing.  It is here for mathematical complete‐
424              ness  and  for possible forward compatibility.  It theoretically
425              selects the compression method of the zlib compression, but  the
426              Z  library  knows  only  one method today, so there's nothing to
427              choose.
428
429              The default is the default of the zlib library.
430
431              This option was new in Netpbm 10.30 (October 2005).
432
433
434       -comp_window_bits=N
435              This option tells how big a window the  zlib  compression  algo‐
436              rithm  uses.   The  value  is the base 2 logarithm of the window
437              size in bytes, so 8 means 256 bytes.  The value must be  from  8
438              to 15 (i.e. 256 bytes to 32K).
439
440              See Zlib documentation for details on what this window size is.
441
442              The default is the default of the zlib library.
443
444              This option was new in Netpbm 10.30 (October 2005).
445
446
447       -comp_buffer_size=N
448              This  option  determines  in  what size pieces pnmtopng does the
449              zlib compression.  One compressed piece goes in each IDAT  chunk
450              in  the  PNG.   So  the bigger this value, the fewer IDAT chunks
451              your PNG will have.  Theoretically, this makes the  PNG  smaller
452              because  1)  you  have  less per-IDAT-chunk overhead, and 2) the
453              compression algorithm has more data to work with.  But in  real‐
454              ity,  the difference will probably not be noticeable above about
455              8K, which is the default.
456
457              The value n is the size of the compressed piece (i.e.  the  com‐
458              pression buffer) in bytes.
459
460              This option was new in Netpbm 10.30 (October 2005).
461
462
463
464       -force When  you  specify this, pnmtopng limits its optimizations.  The
465              resulting PNG output is as similar to the Netpbm input as possi‐
466              ble.   For  example, the PNG output will not be paletted and the
467              transparency channel will be represented as a full  transparency
468              channel  even  if the information could be represented more suc‐
469              cinctly with a transparency chunk.
470
471
472
473
474       -libversion
475              This option causes pnmtopng to display version information about
476              itself  and the libraries it uses, in addition to all its normal
477              function.  Do not confuse this with  the  Netpbm  common  option
478              -version,  which  causes the program to display version informa‐
479              tion about the Netpbm library and do nothing else.
480
481              You can't really use this option in a program that invokes  pnm‐
482              topng  and  needs to know which version it is.  Its function has
483              changed too much over the history of pnmtopng.   The  option  is
484              good only for human eyes.
485
486
487
488

SEE ALSO

490       pngtopam(1), pamtopng(1), pnmremap(1), pnmgamma(1), pnm(1)
491
492       For   information   on   the   PNG  format,  see  http://schaik.com/png
493http://schaik.com/png⟩ .
494
495

AUTHOR

497       Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
498

DOCUMENT SOURCE

500       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
501       source.  The master documentation is at
502
503              http://netpbm.sourceforge.net/doc/pnmtopng.html
504
505netpbm documentation             13 March 2019         Pnmtopng User Manual(0)
Impressum