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

SEE ALSO

445       pngtopam(1), pamtopng(1), pnmremap(1), pnmgamma(1), pnm(1)
446
447       For   information   on   the   PNG  format,  see  http://schaik.com/png
448http://schaik.com/png⟩ .
449
450

AUTHOR

452       Copyright (C) 1995-1997 by Alexander Lehmann and Willem van Schaik.
453

DOCUMENT SOURCE

455       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
456       source.  The master documentation is at
457
458              http://netpbm.sourceforge.net/doc/pnmtopng.html
459
460netpbm documentation            09 October 2016        Pnmtopng User Manual(0)
Impressum