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

NAME

6       pamtogif - convert a Netpbm image to a GIF image
7
8

SYNOPSIS

10       pamtogif
11
12       [-interlace]
13
14       [-sort]
15
16       [-mapfile=mapfile] [-transparent=[=]color]
17
18       [-alphacolor=color]
19
20       [-comment=text]
21
22       [-noclear]
23
24       [-nolzw]
25
26       [-aspect=fraction]
27
28       [-verbose] [netpbmfile]
29
30       All  options  can  be abbreviated to their shortest unique prefix.  You
31       may use two hyphens instead of one to designate an option.  You may use
32       either  white  space  or  an equals sign between an option name and its
33       value.
34
35

DESCRIPTION

37       This program is part of Netpbm(1).
38
39       pamtogif reads a Netpbm image as input and produces a GIF file as  out‐
40       put.
41
42       This  program  creates only individual GIF images.  To combine multiple
43       GIF    images    into     an     animated     GIF,     use     gifsicle
44http://www.lcdf.org/gifsicle/⟩  (not part of the Netpbm package).
45
46       pamtogif  creates either an original GIF87 format GIF file or the newer
47       GIF89 format.  It creates GIF89 when you request features that were new
48       with GIF89, to wit the -transparent or -comment options.  Otherwise, it
49       creates GIF87.  Really old GIF readers conceivably could not  recognize
50       GIF89.
51
52       The  GIF  format is not capable of representing an image with more than
53       256 colors in it (it contains a color map with a maximum size of  256).
54       If the image you want to convert has more colors than that (ppmhist can
55       tell you), you can use pnmquant to reduce it to 256.  Or use  the  more
56       complex but faster method described under the -mapfile option.
57
58       If  your  input  image is a PAM with transparency information, ppmtogif
59       uses one entry in the GIF colormap  specifically  for  the  transparent
60       pixels, so you can have at most 255 opaque colors.  In contrast, if you
61       use the -transparent option, one of the colors from the  input  becomes
62       transparent, so the limit is still 256.
63
64       pamtogif was new in Netpbm 10.37 (December 2006).  In older Netpbm, use
65       ppmtogif.
66
67

OPTIONS

69       -interlace
70              Produce an interlaced GIF file.
71
72
73       -sort  Produce a GIF file with a color  map  sorted  in  a  predictable
74              order.
75
76              This  does not produce the sorted color map which is part of the
77              GIF format.  That kind of sorted color map is one where the col‐
78              ors  are sorted according to how important they are, and the GIF
79              header tells the viewer that it is sorted that way.  Its purpose
80              is to allow the viewer to use fewer colors than are in the color
81              map if it is not capable of displaying all the colors.
82
83              What this option produces is a color map sorted  by  red  value,
84              then  green,  then  blue.   That  can be useful in analyzing GIF
85              images, particularly those made with two versions  of  the  pro‐
86              gram, because it removes some of the variability.
87
88
89
90       -mapfile=mapfile
91
92              Use  the colors found in the file mapfile to create the colormap
93              in the GIF file, instead of the colors from netpbmfile.  mapfile
94              can  be  any PPM file; all that matters is the colors in it.  If
95              the colors in netpbmfile do not match those in mapfile, pamtogif
96              matches  them  to  a  "best match." You can obtain a much better
97              result by using pnmremap to change the colors in  the  input  to
98              those in the map file.
99
100              The mapfile file is not a palette file, just an image whose col‐
101              ors you want to use.  The order of colors  in  the  GIF  palette
102              have  nothing to do with where they appear in the mapfile image,
103              and duplication of colors in the image is irrelevant.
104
105              The map file's depth must match the number of  color  components
106              in  the  input (which is not necessarily the same as the input's
107              depth -- the input might have a transparency plane in addition).
108              If  your  map  file  does  not,  or it might not, run your input
109              through pnmremap using the same map file so that it does.
110
111              You can use -mapfile to speed up conversion of  an  image  where
112              you  already  have  a  map file because of earlier processing of
113              your image.  For example, it is common to start  with  an  image
114              that  has  more than 256 colors and remap its colors to a set of
115              256 colors so that pamgtogif can convert it (a GIF can have only
116              256  colors;  pamtogif  without -mapfile fails on any image that
117              has more than that) with pnmquant.  When you do  this,  pnmquant
118              generates  a palette to do the color quantization, then pamtogif
119              generates an identical palette from the  quantized  image.   You
120              can save computation by generating the palette once:
121
122                  $ pnmcolormap 256 myimage.ppm >/tmp/colormap.ppm
123                  $ pamtogif myimage.ppm -mapfile=/tmp/colormap.ppm >output.gif
124
125
126
127       -transparent=color
128              pamtogif  marks  the  specified  color as transparent in the GIF
129              image.
130
131              If you don't specify -transparent, pamtogif does  not  mark  any
132              color  transparent  (except  as  indicated  by  the transparency
133              information in the input file).
134
135              Specify the color (color) as described for the argument  of  the
136              ppm_parsecolor() library routine ⟨libppm.html#colorname⟩ .
137
138              If  the  color you specify is not present in the image, pamtogif
139              selects instead the color in the image that is  closest  to  the
140              one  you specify.  Closeness is measured as a Cartesian distance
141              between colors in RGB space.  If multiple  colors  are  equidis‐
142              tant, pamtogif chooses one of them arbitrarily.
143
144              However,  if  you prefix your color specification with "=", e.g.
145              -transparent==red, only the exact  color  you  specify  will  be
146              transparent.   If that color does not appear in the image, there
147              will be no transparency.  pamtogif issues an information message
148              when this is the case.
149
150              When  you specify -transparent, pamtogif ignores explicit trans‐
151              parency information (the "alpha channel") in the input image.
152
153
154       -alpha=pgmfile
155              There is no -alpha option.  pamtogif's predecessor had  such  an
156              option  because it was not capable of taking PAM input that con‐
157              tains a transparency (alpha) plane, so one used this  option  to
158              supply a transparency plane as a separate PGM file.
159
160               This  option names a PGM file that contains a transparency mask
161              for the image.  pamtogif creates fully transparent pixels  wher‐
162              ever  the  transparency mask indicates transparency greater than
163              50%.  The color of those pixels is that specified by the -alpha‐
164              color option, or black by default.
165
166              To  do  this,  pamtogif  creates an entry in the GIF colormap in
167              addition to the entries for colors  that  are  actually  in  the
168              image.   It  marks  that  colormap entry as transparent and uses
169              that colormap index in the output image to create a  transparent
170              pixel.
171
172               The transparency image must be the same dimensions as the input
173              image, but may have any maxval.  White means  opaque  and  black
174              means transparent.
175
176               You cannot specify both -transparent and -alpha.
177
178
179       -alphacolor=color
180              This  specifies  the foreground color for transparent pixels.  A
181              viewer may use the foreground color for a transparent  pixel  if
182              it  chooses  not  to  have  another  color "show through.".  The
183              default is black.
184
185              This applies only to pixels that  are  transparent  in  the  GIF
186              because  they  are  transparent  in  the Netpbm input.  If a GIF
187              pixel is transparent because of  the  -transparent  option,  the
188              foreground color is the color indicated by that option.
189
190              Note  that  in  GIF,  all transparent pixels have the same fore‐
191              ground color.  (There is only one entry in the GIF colormap  for
192              transparent pixels).
193
194              Specify  the  color (color) as described for the argument of the
195              ppm_parsecolor() library routine ⟨libppm.html#colorname⟩ .
196
197
198       -comment=text
199              Include a comment in the GIF output with comment text text.
200
201              Without this option, there are no comments in the output.
202
203              Note that in a command shell, you'll have to use quotation marks
204              around  text  if  it contains characters (e.g. space) that would
205              make the shell think it is multiple arguments:
206              $ pamtogif -comment "this is a comment" <xxx.ppm >xxx.gif
207
208
209       -noclear
210
211              This option causes the output  not  to  contain  any  GIF  clear
212              codes.
213
214              In  GIF, the stream defines codes that represent strings of pix‐
215              els as it goes.  The stream contains definitions of codes  mixed
216              in  with  the references to those codes that describe the pixels
217              of the image.  GIF specifies a maximum number of codes that  can
218              be  defined;  when  the stream has defined that many, the stream
219              can either just use those for the rest of the image or include a
220              clear code, deleting all the string codes so that the stream can
221              start over defining new ones.
222
223              By far the most common choice is the clear code.   This  usually
224              results in a smaller stream because the set of strings of pixels
225              that occur in an image vary over the parts of the image.  Hardly
226              any GIF encoders produce streams that don't use the clear code.
227
228              But it is conceivable that a stream could be smaller without the
229              use of the clear code because it  saves  the  stream  having  to
230              redefine  the  same  string  codes over and over.  It could even
231              avoid a thrashing situation where the stream continually defines
232              a set of strings that never get used again before the maximum is
233              reached.
234
235              The default is to use the clear codes.
236
237              This option was new in Netpbm 10.82 (March 2018).  Before  that,
238              the program aways uses the clear codes.
239
240
241       -nolzw
242
243              This  option is mainly of historical interest -- it involves use
244              of a patent that is now expired.
245
246              This option causes the GIF output, and thus pamtogif, not to use
247              LZW  (Lempel-Ziv)  compression.   As a result, the image file is
248              larger and, before the patent expired,  no  royalties  would  be
249              owed  to  the  holder  of  the  patent  on LZW.  See the section
250              LICENSE below.
251
252              LZW is a method for combining the information from multiple pix‐
253              els  into  a  single GIF code.  With the -nolzw option, pamtogif
254              creates one GIF code per pixel, so it is not doing any  compres‐
255              sion  and  not  using LZW.  However, any GIF decoder, whether it
256              uses an LZW decompressor or  not,  will  correctly  decode  this
257              uncompressed  format.   An  LZW decompressor would see this as a
258              particular case of LZW compression.
259
260              Note that if someone uses an LZW decompressor such as the one in
261              giftopnm  or pretty much any graphics display program to process
262              the output of pamtogif -nolzw , he is then using the LZW patent.
263              But  the  patent holder expressed far less interest in enforcing
264              the patent on decoding than on encoding.
265
266
267       -aspect=fraction
268              This is the aspect ratio of the pixels of the image.   Its  only
269              effect is to record that information in the GIF for use by what‐
270              ever interprets the GIF.  Note  that  this  feature  of  GIF  is
271              hardly  ever  used and most GIF decoders ignore this information
272              and assume pixels are square.
273
274              Pixels in a Netpbm image do not have  aspect  ratios;  there  is
275              always  a  one-one  correspondence between GIF pixels and Netpbm
276              pixels.
277
278              The aspect ratio is the quotient of  width  divided  by  height.
279              GIF  allows  aspect  ratios from 0.25 (1:4) to 4 (4:1) in incre‐
280              ments of 1/64.  pamtogif implements a natural extension  of  GIF
281              that  allows an aspect ratio up to 4 14/64.  If you specify any‐
282              thing outside this range, pamtogif fails.  pamtogif rounds frac‐
283              tion to the nearest 1/64.
284
285              The default is square (1.0).
286
287              This  option was new in Netpbm 10.38 (March 2007).  Before that,
288              the pixels are always square.
289
290
291
292       -verbose
293              This option causes pamtogif to  display  information  about  the
294              conversion process and the image it produces.
295
296
297
298

SEE ALSO

300       giftopnm(1), pnmremap(1), ppmtogif(1),
301
302       gifsicle  http://www.lcdf.org/gifsiclehttp://www.lcdf.org/gifsicle⟩ ,
303       pnm(1), pam(1).
304
305

HISTORY

307       pamtogif was new in Netpbm 10.37 (December  2006).   It  replaced  ppm‐
308       togif, which created GIF images for Pbmplus/Netpbm users since 1989.
309
310       The main outward change in the conversion from ppmtogif to pamtogif was
311       that pamtogif was able to use transparency  information  ("alpha  chan‐
312       nel") in PAM input, whereas with ppmtogif, one had to supply the trans‐
313       parency mask in a separate pseudo-PGM image (via the -alpha option).
314
315       Jef Poskanzer wrote ppmtogif in 1989, and it has always been a  corner‐
316       stone  of  Pbmplus/Netpbm  because  GIF is such a popular image format.
317       Jef based the LZW encoding on GIFENCOD by  David  Rowley  <mgardi@watd‐
318       csu.waterloo.edu>.  Jef included GIFENCOD's GIFCOMPR.C file pretty much
319       whole.  Rowley, in turn, adapted the LZW compression code from  classic
320       Unix  compress,  which used techniques described in IEEE Computer, June
321       1984.
322
323       Jef's ppmtogif notably lacked the ability to use  a  transparency  mask
324       with  it.   You could create transparent pixels in a GIF, but only with
325       the -transparent option, which allowed one to specify that  all  pixels
326       of  a certain color in the input were to be transparent.  Bryan Hender‐
327       son added the -alpha option in July 2001 so you  could  supply  a  mask
328       image  that  indicates  exactly which pixels are to be transparent, and
329       those pixels could have the same color as other opaque ones.
330
331       Bryan Henderson added another significant piece of code and function in
332       October  2001:  the  ability  to  generate  a GIF without using the LZW
333       patent -- an uncompressed GIF.  This was very important to many  people
334       at the time because the GIF patent was still in force, and this allowed
335       them to make an image that any GIF viewer could display,  royalty-free.
336       Bryan adapted code from the Independent JPEG Group's djpeg for that.
337
338       There  is  no  code  in pamtogif from Jef's original, but Jef may still
339       hold copyright over it because of the way in which it evolved.   Virtu‐
340       ally  all  of  the  code in pamtogif was written by Bryan Henderson and
341       contributed to the public domain.
342
343
344

LICENSE

346       If you use pamtogif without the -nolzw option, you are using  a  patent
347       on the LZW compression method which is owned by Unisys.  The patent has
348       expired (in 2003 in the US and in 2004 elsewhere), so it  doesn't  mat‐
349       ter.   While the patent was in force, most people who used pamtogif and
350       similar programs did so without a license from Unisys to do so.  Unisys
351       typically  asked  $5000  for  a  license for trivial use of the patent.
352       Unisys never enforced the patent against trivial users.
353
354       Rumor has it that IBM also owns or owned a patent covering pamtogif.
355
356       A replacement for the GIF format that never required any patents to use
357       is the PNG format.
358

DOCUMENT SOURCE

360       This  manual  page was generated by the Netpbm tool 'makeman' from HTML
361       source.  The master documentation is at
362
363              http://netpbm.sourceforge.net/doc/pamtogif.html
364
365netpbm documentation             22 March 2007         Pamtogif User Manual(0)
Impressum