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       [-nolzw]
23
24       [-aspect=fraction]
25
26       [-verbose] [netpbmfile]
27
28       All  options  can  be abbreviated to their shortest unique prefix.  You
29       may use two hyphens instead of one to designate an option.  You may use
30       either  white  space  or  an equals sign between an option name and its
31       value.
32
33

DESCRIPTION

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

OPTIONS

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

SEE ALSO

266       giftopnm(1), pnmremap(1), ppmtogif(1),
267
268       gifsicle http://www.lcdf.org/gifsiclehttp://www.lcdf.org/gifsicle⟩  ,
269       pnm(1), pam(1).
270
271

HISTORY

273       pamtogif  was  new  in  Netpbm 10.37 (December 2006).  It replaced ppm‐
274       togif, which created GIF images for Pbmplus/Netpbm users since 1989.
275
276       The main outward change in the conversion from ppmtogif to pamtogif was
277       that  pamtogif  was  able to use transparency information ("alpha chan‐
278       nel") in PAM input, whereas with ppmtogif, one had to supply the trans‐
279       parency mask in a separate pseudo-PGM image (via the -alpha option).
280
281       Jef  Poskanzer wrote ppmtogif in 1989, and it has always been a corner‐
282       stone of Pbmplus/Netpbm because GIF is such  a  popular  image  format.
283       Jef  based  the  LZW encoding on GIFENCOD by David Rowley <mgardi@watd‐
284       csu.waterloo.edu>.  Jef included GIFENCOD's GIFCOMPR.C file pretty much
285       whole.   Rowley, in turn, adapted the LZW compression code from classic
286       Unix compress, which used techniques described in IEEE  Computer,  June
287       1984.
288
289       Jef's  ppmtogif  notably  lacked the ability to use a transparency mask
290       with it.  You could create transparent pixels in a GIF, but  only  with
291       the  -transparent  option, which allowed one to specify that all pixels
292       of a certain color in the input were to be transparent.  Bryan  Hender‐
293       son  added  the  -alpha  option in July 2001 so you could supply a mask
294       image that indicates exactly which pixels are to  be  transparent,  and
295       those pixels could have the same color as other opaque ones.
296
297       Bryan Henderson added another significant piece of code and function in
298       October 2001: the ability to generate  a  GIF  without  using  the  LZW
299       patent  -- an uncompressed GIF.  This was very important to many people
300       at the time because the GIF patent was still in force, and this allowed
301       them  to make an image that any GIF viewer could display, royalty-free.
302       Bryan adapted code from the Independent JPEG Group's djpeg for that.
303
304       There is no code in pamtogif from Jef's original,  but  Jef  may  still
305       hold  copyright over it because of the way in which it evolved.  Virtu‐
306       ally all of the code in pamtogif was written  by  Bryan  Henderson  and
307       contributed to the public domain.
308
309
310

LICENSE

312       If  you  use pamtogif without the -nolzw option, you are using a patent
313       on the LZW compression method which is owned by Unisys.  The patent has
314       expired  (in  2003 in the US and in 2004 elsewhere), so it doesn't mat‐
315       ter.  While the patent was in force, most people who used pamtogif  and
316       similar programs did so without a license from Unisys to do so.  Unisys
317       typically asked $5000 for a license for  trivial  use  of  the  patent.
318       Unisys never enforced the patent against trivial users.
319
320       Rumor has it that IBM also owns or owned a patent covering pamtogif.
321
322       A replacement for the GIF format that never required any patents to use
323       is the PNG format.
324

DOCUMENT SOURCE

326       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
327       source.  The master documentation is at
328
329              http://netpbm.sourceforge.net/doc/pamtogif.html
330
331netpbm documentation             22 March 2007         Pamtogif User Manual(0)
Impressum