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

SEE ALSO

466       pngtopam(1), pamtopng(1), pnmremap(1), pnmgamma(1), pnm(1)
467
468       For   information   on   the   PNG  format,  see  http://schaik.com/png
469http://schaik.com/png⟩ .
470
471

AUTHOR

473       Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
474

DOCUMENT SOURCE

476       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
477       source.  The master documentation is at
478
479              http://netpbm.sourceforge.net/doc/pnmtopng.html
480
481netpbm documentation             13 March 2019         Pnmtopng User Manual(0)
Impressum