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

NAME

6       pamtopng - convert a Netpbm image to PNG
7
8

SYNOPSIS

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

OPTION USAGE

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

DESCRIPTION

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 trans‐
57       parency information in the PNG.  In contrast,  handling  of  the  alpha
58       channel 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

OPTIONS

130       -transparent=color
131              pamtopng  marks  the  specified  color as transparent in the PNG
132              image.
133
134              Specify the color (color) as described for the argument  of  the
135              pnm_parsecolor()                 library                 routine
136              ⟨libnetpbm_image.html#colorname⟩ .  E.g. red or rgb:ff/00/0d.
137
138
139       -background=color
140              This causes pamtopng to create a background color chunk  in  the
141              PNG output which can be used for subsequent transparency channel
142              or transparent color conversions.  Specify color the same as for
143              -transparent.
144
145
146       -gamma=value
147              This  causes  pnmtopng to create a gAMA chunk.  This information
148              helps describe how the color values in the PNG  must  be  inter‐
149              preted.   Without  the  gAMA  chunk, whatever interprets the PNG
150              must get this information separately (or just  assume  something
151              standard).  If your input is a true PPM or PGM image, you should
152              specify -gamma=.45.  But sometimes people generate images  which
153              are  ostensibly  PPM  except  the  image  uses a different gamma
154              transfer function than the one specified for PPM.  A common case
155              of  this  is  when  the image is created by simple hardware that
156              doesn't have digital computational ability.  Also,  some  simple
157              programs  that  generate  images from scratch do it with a gamma
158              transfer in which the gamma value is 1.0.
159
160
161       -chroma=chroma_list
162              This option specifies how red, green, and blue component  values
163              of a pixel specify a particular color, by telling the chromatic‐
164              ities of those 3 primary illuminants and  of  white  (i.e.  full
165              strength of all three).
166
167              The  chroma_list  value  is a blank-separated list of 8 floating
168              point decimal numbers.  The CIE-1931 X and Y chromaticities  (in
169              that  order)  of  each  of  white, red, green, and blue, in that
170              order.
171
172              This information goes into the PNG's cHRM chunk.
173
174              In a shell command, make sure you use quotation  marks  so  that
175              the blanks in chroma_list don't make the shell see multiple com‐
176              mand arguments.
177
178
179       -srgbintent=intent
180              This asserts that the input is a pseudo-Netpbm image  that  uses
181              an  sRGB  color space (unlike true Netpbm) and indicates how you
182              intend for the colors to be rendered.   It  causes  pamtopng  to
183              include  an  sRGB  chunk  in  the  PNG image that specifies that
184              intent, so see the PNG documentation  for  more  information  on
185              what this really means.
186
187              intent is one of:
188
189
190
191       ·      perceptual
192
193       ·      relativecolorimetric
194
195       ·      saturation
196
197       ·      absolutecolorimetric
198
199
200
201       -text=filename
202              This  option  lets you include arbitrary text strings in the PNG
203              output, as tEXt chunks.
204
205              filename is the name of a file that contains your text strings.
206
207              The output contains a distinct tEXt chunk for each entry in  the
208              file.
209
210              Here is an example of a text string file:
211
212                   Title           PNG file
213                   Author          John Doe
214                   Description     how to include a text chunk
215                                      PNG file
216                   "Creation Date" 2015-may-11
217                   Software        pamtopng
218
219              The file is divided into entries, each entry comprising consecu‐
220              tive lines of text.  The first line of an entry  starts  in  the
221              first  column  (i.e.  the  first  column is not white space) and
222              every other line has white space in the first column.  The first
223              entry starts in the first line, so it is not valid for the first
224              line of the file to have white space in its first column.
225
226              The first word in an entry is the key of the text  string  (e.g.
227              'Title').   It begins in column one of the line and continues up
228              to, but not including, the first delimiter character or the  end
229              of  the  line,  whichever  is first.  You can enclose the key in
230              double quotes in which case the key  can  consists  of  multiple
231              words.  The quotes are not part of the key.  The text string per
232              se begins after the key and any delimiter characters  after  it,
233              plus the text in subsequent continuation lines.
234
235              There  is  no limit on the length of a file line or entry or key
236              or text string.  There is no limit on the number of entries.
237
238
239       -ztxt=filename
240              The same as -text, except the text string is compressed  in  the
241              PNG output.  pnmtopng uses zTXt chunks instead of a tEXt chunks.
242
243
244       -itxt=filename
245              Similar  to  -text,  but  the  text strings can be in a language
246              other than English.  The PNG image indicates what language  that
247              is  and  includes  the  text string key both in English and that
248              language.  pnmtopng uses iTXt chunks instead of tEXt chunks.
249
250              For each record, you must specify the language and give the  key
251              both in English and in the text string language.
252
253              Example:
254
255                   Language        nl-NL  Taal             nl-NL
256                      Title           nl-NL  Titel            PNG file
257                      Author          nl-NL  Auteur           Pietje Puk
258                      Description     nl-NL  Omschrijving     Tekst in het Nederlands.
259
260              The  language  specification is based on the ISO 639-1 standard,
261              see http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for the
262              valid  codes.   The  format is either a two character "nl" or an
263              extended code like "en-US".
264
265
266       -time='[yy]yy-mm-dd hh:mm:ss'
267              This option allows you to specify the modification time value to
268              be placed in the PNG output.  You can specify the year parameter
269              either as a two or four digit value.
270
271
272       -interlace
273              This causes the PNG file to be interlaced, in Adam7 format.  The
274              interlaced  format is one in which the raster data starts with a
275              low-resolution representation of the entire image, then  contin‐
276              ues  with additional information for the entire image, then even
277              more information, etc.  In Adam7 in particular, there are  seven
278              such  passes  of  the  whole image.  This is useful when you are
279              receiving the image over a slow communication line as someone is
280              waiting  to  see  it.   The simplest thing to do in that case is
281              wait for  the  entire  image  to  arrive  and  then  display  it
282              instantly,  but then the user is wasting time staring at a blank
283              space until the whole image arrives.   With  the  standard  non-
284              interlaced  format,  the data arrives row-by-row starting at the
285              top, so the displayer could display each row of the image as  it
286              arrives  and  gradually  paint  down to the bottom.  But with an
287              interlaced image, the displayer can start by showing a low-reso‐
288              lution  version of the image, then gradually improve the display
289              as more data arrives.
290
291              When you specify this option,  pamtopng  must  hold  the  entire
292              image  in  memory at once, whereas without it, the program holds
293              only one raster row at a time.  If you don't have enough  memory
294              for  that,  you  might suffer extreme slowdowns or failure - not
295              just in the process running pamtopng, but potentially throughout
296              the  system  that shares memory with it.  pnmtopng does not have
297              this limitation (it holds only one row at a time in memory  even
298              when generating an interlaced PNG).
299
300              This option was new in Netpbm 10.86 (March 2019).
301
302
303       -verbose
304              This  causes the program to display various facts about the con‐
305              version.
306
307
308
309
310

SEE ALSO

312       pngtopam(1), pnmtopng(1), pam(1), pnm(1)
313
314       For  information  on  the  PNG  format,  see  http://www.w3.org/TR/PNG/
315http://www.w3.org/TR/PNG/⟩         ,        http://libpng.org/pub/png/
316http://libpng.org/pub/png/⟩                                          ,
317       http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
318http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes⟩              and
319       http://schaik.com/png/http://schaik.com/png/⟩ .
320
321

HISTORY

323       pamtopng was new in Netpbm 10.70 (June 2015).
324
325       Before  pamtopng,  the  two  ways to create PNG images with Netpbm were
326       pnmtopng and pamrgbatopng.  The history  of  the  former  is  discussed
327       above.  The latter was added to Netpbm in 2005 as a cheap way to fill a
328       significant need that pnmtopng did not: the ability to turn  the  alpha
329       channel in a PAM image into the alpha channel in a PNG image.
330
331       Handling  of the alpha channel with pnmtopng is very cumbersome (as was
332       dealing with alpha channels in general before the introduction  of  the
333       PAM  format).   pamrgbatopng could do what people wanted with the alpha
334       channel, but nothing else.  It was a very small program with  literally
335       no command line options.
336
337       The  goal in those days was eventually to expand pnmtopng to do the PAM
338       alpha channel thing, rename it to pamtopng,  and  retire  pamrgbatopng.
339       But  pnmtopng  is such a complex program, because of its dizzying array
340       of features and its need for backward compatibility, that  adding  that
341       one  capability  to  it  was  a  daunting task and for ten years nobody
342       attempted it.
343
344       In 2015, one of the authors of the original pnmtopng  (from  before  it
345       was  even  part of Netpbm -- a program that shared essentially no lines
346       of code with pnmtopng of 2015) decided to go in a different  direction.
347       While  many  features  of  pnmtopng  were  pretty important and easy to
348       implement, many others were probably of no use in the modern  world  or
349       at  least  not  important enough to justify the complexity they lent to
350       the code.  (The features thought to be outdated  were  ones  that  were
351       intended  to make the PNG output slightly smaller - something consider‐
352       ably less important with the declining cost of computer resources).
353
354       And there was an opportunity to drop those features: We could  use  the
355       new  name 'pamtopng' for a new program, keep the existing program under
356       the name 'pnmtopng', and avoid most backward compatibility trouble.
357
358       Therefore, Willem van Schaik wrote an intermediate level  program  that
359       had all the most important features of pnmtopng, plus the alpha channel
360       handling of pamrgbatopng, with nice, simple code.  That was pamtopng.
361
362       Because pamrgbatopng had no options, pamtopng was  backward  compatible
363       with  it  without even trying.  Therefore, as soon as we added pamtopng
364       to Netpbm, we removed pamrgbatopng and recommended that pamrgbatopng be
365       installed as an alias for pamtopng.
366
367
368

AUTHOR

370       Copyright  (C)  1995-1997  by  Alexander Lehmann and Willem van Schaik.
371       Copyright (C) 2015 by Willem van Schaik.
372

DOCUMENT SOURCE

374       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
375       source.  The master documentation is at
376
377              http://netpbm.sourceforge.net/doc/pamtopng.html
378
379netpbm documentation             13 March 2019         Pamtopng User Manual(0)
Impressum