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.
54
55       If your input image is a PAM with  transparency  information,  ppmtogif
56       uses  one  entry  in  the GIF colormap specifically for the transparent
57       pixels, so you can have at most 255 opaque colors.  In contrast, if you
58       use  the  -transparent option, one of the colors from the input becomes
59       transparent, so the limit is still 256.
60
61       pamtogif was new in Netpbm 10.37 (December 2006).  In older Netpbm, use
62       ppmtogif.
63
64

OPTIONS

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

SEE ALSO

250       giftopnm(1), pnmremap(1), ppmtogif(1),
251
252       gifsicle http://www.lcdf.org/gifsiclehttp://www.lcdf.org/gifsicle⟩  ,
253       pnm(1), pam(1).
254
255

HISTORY

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

LICENSE

296       If  you  use pamtogif without the -nolzw option, you are using a patent
297       on the LZW compression method which is owned by Unisys.  The patent has
298       expired  (in  2003 in the US and in 2004 elsewhere), so it doesn't mat‐
299       ter.  While the patent was in force, most people who used pamtogif  and
300       similar programs did so without a license from Unisys to do so.  Unisys
301       typically asked $5000 for a license for  trivial  use  of  the  patent.
302       Unisys never enforced the patent against trivial users.
303
304       Rumor has it that IBM also owns or owned a patent covering pamtogif.
305
306       A replacement for the GIF format that never required any patents to use
307       is the PNG format.
308
309
310
311netpbm documentation             22 March 2007         Pamtogif User Manual(0)
Impressum