Debian Codegraph @

upstream/debian-unstable/man1/pamtogif.1

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "Pamtogif User Manual" 1 "09 June 2021" "netpbm documentation"
7
8 .SH NAME
9 pamtogif - convert a Netpbm image to a GIF image
10
11 .UN synopsis
12 .SH SYNOPSIS
13
14 \fBpamtogif\fP
15
16 [\fB-interlace\fP]
17
18 [\fB-sort\fP]
19
20 [\fB-mapfile=\fP\fImapfile\fP]
21 [\fB-transparent=\fP[\fB=\fP]\fIcolor\fP]
22
23 [\fB-alphacolor=\fP\fIcolor\fP]
24
25 [\fB-comment=\fP\fItext\fP]
26
27 [\fB-noclear\fP]
28
29 [\fB-nolzw\fP]
30
31 [\fB-aspect=\fP\fIfraction\fP]
32
33 [\fB-verbose\fP]
34 [\fInetpbmfile\fP]
35 .PP
36 All options can be abbreviated to their shortest unique prefix. You
37 may use two hyphens instead of one to designate an option. You may
38 use either white space or an equals sign between an option name and its
39 value.
40
41 .UN description
42 .SH DESCRIPTION
43 .PP
44 This program is part of
45 .BR "Netpbm" (1)\c
46 \&.
47 .PP
48 \fBpamtogif\fP reads a Netpbm image as input and produces a GIF file
49 as output.
50 .PP
51 This program creates only individual GIF images. To combine
52 multiple GIF images into an animated GIF, use
53 .UR http://www.lcdf.org/gifsicle/
54 \fBgifsicle\fP
55 .UE
56 \& (not part of
57 the Netpbm package).
58 .PP
59 \fBpamtogif\fP creates either an original GIF87 format GIF file or the
60 newer GIF89 format. It creates GIF89 when the output needs to have features
61 that were new with GIF89, to wit transparency or comments. Otherwise, it
62 creates GIF87. Really old GIF readers conceivably could not recognize
63 GIF89. The output needs to have transparency when either the input has a
64 transparency information or you specify the \fB-transparent\fP option. It
65 needs to have comments when you specify the
66 \fB-comment\fP option.
67 .PP
68 \fBpamtogif\fP generates a GIF image with a single image block, which
69 means the image cannot have more than 256 colors in it (it contains a single
70 color map with a maximum size of 256). If the image you want to convert has
71 more colors than that (\fBppmhist\fP can tell you), you can
72 use \fBpnmquant\fP to reduce it to 256. Or use the more complex but faster
73 method described under the \fB-mapfile\fP option.
74 .PP
75 If your input image is a PAM with transparency information, \fBpamtogif\fP
76 uses one entry in the GIF colormap specifically for the transparent pixels,
77 so you can have at most 255 opaque colors. In contrast, if you use the
78 \fB-transparent\fP option, one of the colors from the input becomes
79 transparent, so the limit is still 256.
80 .PP
81 \fBpamtogif\fP recognizes transparency information in the input by the
82 tuple type being \fBRGB_ALPHA\fP, \fBGRAYSCALE_ALPHA\fP, or
83 \fBBLACKANDWHITE_ALPHA\fP. This is the case for any image that has
84 transparency information and was created by a Netpbm program that
85 manipulates visual images. If, on the other hand, you have a PAM generated
86 some other way, but you know the planes have the same meaning as implied by
87 these tuple types, you can make \fBpamtogif\fP process the transparency
88 information by changing the tuple type accordingly before you pass it
89 to \fBpamtogif\fP. You can use \fBpamstack\fP to change the tuple type.
90 .PP
91 \fBpamtogif\fP was new in Netpbm 10.37 (December 2006). In older Netpbm,
92 use \fBppmtogif\fP.
93
94 .UN options
95 .SH OPTIONS
96 .PP
97 In addition to the options common to all programs based on libnetpbm
98 (most notably \fB-quiet\fP, see
99 .UR index.html#commonoptions
100 Common Options
101 .UE
102 \&), \fBpamtogif\fP recognizes the following
103 command line options:
104
105
106
107 .TP
108 \fB-interlace\fP
109 Produce an interlaced GIF file.
110
111 .TP
112 \fB-sort\fP
113 Produce a GIF file with a color map sorted in a predictable order.
114 .sp
115 This does \fInot\fP produce the sorted color map which is part
116 of the GIF format. That kind of sorted color map is one where the
117 colors are sorted according to how important they are, and the GIF
118 header tells the viewer that it is sorted that way. Its purpose is to
119 allow the viewer to use fewer colors than are in the color map if it
120 is not capable of displaying all the colors.
121 .sp
122 What this option produces is a color map sorted by red value, then
123 green, then blue. That can be useful in analyzing GIF images, particularly
124 those made with two versions of the program, because it removes some of
125 the variability.
126
127
128 .TP
129 \fB-mapfile=\fP\fImapfile\fP
130 .sp
131 Use the colors found in the file \fImapfile\fP to create the
132 colormap in the GIF file, instead of the colors from \fInetpbmfile\fP.
133 \fImapfile\fP can be any PPM file; all that matters is the colors in
134 it. If the colors in \fInetpbmfile\fP do not match those in
135 \fImapfile\fP, \fBpamtogif\fP matches them to a "best
136 match." You can obtain a much better result by using \fBpnmremap\fP
137 to change the colors in the input to those in the map file.
138 .sp
139 The \fImapfile\fP file is not a palette file, just an image whose
140 colors you want to use. The order of colors in the GIF palette have
141 nothing to do with where they appear in the \fImapfile\fP image, and
142 duplication of colors in the image is irrelevant.
143 .sp
144 The map file's depth must match the number of color components in
145 the input (which is not necessarily the same as the input's depth --
146 the input might have a transparency plane in addition). If your map file
147 does not, or it \fImight\fP not, run your input through
148 \fBpnmremap\fP using the same map file so that it does.
149 .sp
150 You can use \fB-mapfile\fP to speed up conversion of an image where you
151 already have a map file because of earlier processing of your image. For
152 example, it is common to start with an image that has more than 256 colors
153 and remap its colors to a set of 256 colors so that \fBpamgtogif\fP can
154 convert it (a GIF can have only 256 colors; \fBpamtogif\fP without
155 \fB-mapfile\fP fails on any image that has more than that) with
156 \fBpnmquant\fP. When you do this, \fBpnmquant\fP generates a palette to do
157 the color quantization, then \fBpamtogif\fP generates an identical palette
158 from the quantized image. You can save computation by generating the palette
159 once:
160
161 .nf
162 \f(CW
163 $ pnmcolormap 256 myimage.ppm >/tmp/colormap.ppm
164 $ pamtogif myimage.ppm -mapfile=/tmp/colormap.ppm >output.gif
165 \fP
166
167 .fi
168
169
170 .TP
171 \fB-transparent=\fP\fIcolor\fP
172 \fBpamtogif\fP marks the specified color as transparent in the GIF image.
173 .sp
174 If you don't specify \fB-transparent\fP, \fBpamtogif\fP does not
175 mark any color transparent (except as indicated by the transparency
176 information in the input file).
177 .sp
178 Specify the color (\fIcolor\fP) as described for the
179 .UR libnetpbm_image.html#colorname
180 argument of the \fBpnm_parsecolor()\fP library routine
181 .UE
182 \&.
183 .sp
184 If the color you specify is not present in the image, \fBpamtogif\fP
185 selects instead the color in the image that is closest to the one you
186 specify. Closeness is measured as a Cartesian distance between colors
187 in RGB space. If multiple colors are equidistant, \fBpamtogif\fP
188 chooses one of them arbitrarily.
189 .sp
190 However, if you prefix your color specification with "=",
191 e.g. \fB-transparent==red\fP, only the exact color you specify will
192 be transparent. If that color does not appear in the image, there
193 will be no transparency. \fBpamtogif\fP issues an information
194 message when this is the case.
195 .sp
196 When you specify \fB-transparent\fP, \fBpamtogif\fP ignores
197 explicit transparency information (the "alpha channel") in
198 the input image.
199
200 .TP
201 \fB-alphacolor=\fP\fIcolor\fP
202 This specifies the foreground color for transparent pixels. A
203 viewer may use the foreground color for a transparent pixel if it
204 chooses not to have another color "show through.". The
205 default is black.
206 .sp
207 This applies only to pixels that are transparent in the GIF because
208 they are transparent in the Netpbm input. If a GIF pixel is
209 transparent because of the \fB-transparent\fP option, the foreground
210 color is the color indicated by that option.
211 .sp
212 Note that in GIF, all transparent pixels have the same foreground
213 color. (There is only one entry in the GIF colormap for transparent
214 pixels).
215 .sp
216 Specify the color (\fIcolor\fP) as described for the
217 .UR libnetpbm_image.html#colorname
218 argument of the \fBpnm_parsecolor()\fP library routine
219 .UE
220 \&.
221
222 .TP
223 \fB-comment=\fP\fItext\fP
224 Include a comment in the GIF output with comment text \fItext\fP.
225 .sp
226 Without this option, there are no comments in the output.
227 .sp
228 Note that in a command shell, you'll have to use quotation marks around
229 \fItext\fP if it contains characters (e.g. space) that would make the shell
230 think it is multiple arguments:
231 .nf
232 $ pamtogif -comment "this is a comment" <xxx.ppm >xxx.gif
233
234 .fi
235
236 .TP
237 \fB-noclear\fP
238 .sp
239 This option causes the output not to contain any GIF clear codes.
240 .sp
241 In GIF, the stream defines codes that represent strings of pixels as it
242 goes. The stream contains definitions of codes mixed in with the references
243 to those codes that describe the pixels of the image. GIF specifies a maximum
244 number of codes that can be defined; when the stream has defined that many,
245 the stream can either just use those for the rest of the image or include a
246 clear code, deleting all the string codes so that the stream can start over
247 defining new ones.
248 .sp
249 By far the most common choice is the clear code. This usually results in a
250 smaller stream because the set of strings of pixels that occur in an image
251 vary over the parts of the image. Hardly any GIF encoders produce streams
252 that don't use the clear code.
253 .sp
254 But it is conceivable that a stream could be smaller without the use of the
255 clear code because it saves the stream having to redefine the same string
256 codes over and over. It could even avoid a thrashing situation where the
257 stream continually defines a set of strings that never get used again before
258 the maximum is reached.
259 .sp
260 The default is to use the clear codes.
261 .sp
262 This option was new in Netpbm 10.82 (March 2018). Before that, the program
263 aways uses the clear codes.
264
265 .TP
266 \fB-nolzw\fP
267 .sp
268 This option is mainly of historical interest -- it involves use of
269 a patent that is now expired.
270 .sp
271 This option causes the GIF output, and thus \fBpamtogif\fP, not to
272 use LZW (Lempel-Ziv) compression. As a result, the image file is
273 larger and, before the patent expired, no royalties would be owed to
274 the holder of the patent on LZW. See the section LICENSE below.
275 .sp
276 LZW is a method for combining the information from multiple pixels into a
277 single GIF code. With the \fB-nolzw\fP option, \fBpamtogif\fP
278 creates one GIF code per pixel, so it is not doing any compression and not
279 using LZW. However, any GIF decoder, whether it uses an LZW decompressor
280 or not, will correctly decode this uncompressed format. An LZW decompressor
281 would see this as a particular case of LZW compression.
282 .sp
283 Note that if someone uses an LZW decompressor such as the one in
284 \fBgiftopnm\fP or pretty much any graphics display program to process
285 the output of \fBpamtogif -nolzw \fP, he is then using the LZW
286 patent. But the patent holder expressed far less interest in
287 enforcing the patent on decoding than on encoding.
288
289 .TP
290 \fB-aspect=\fP\fIfraction\fP
291 This is the aspect ratio of the pixels of the image. Its only
292 effect is to record that information in the GIF for use by whatever
293 interprets the GIF. Note that this feature of GIF is hardly ever used
294 and most GIF decoders ignore this information and assume pixels are
295 square.
296 .sp
297 Pixels in a Netpbm image do not have aspect ratios; there is always
298 a one-one correspondence between GIF pixels and Netpbm pixels.
299 .sp
300 The aspect ratio is the quotient of width divided by height. GIF
301 allows aspect ratios from 0.25 (1:4) to 4 (4:1) in increments of 1/64.
302 \fBpamtogif\fP implements a natural extension of GIF that allows an
303 aspect ratio up to 4 14/64. If you specify anything outside this range,
304 \fBpamtogif\fP fails. \fBpamtogif\fP rounds \fIfraction\fP to
305 the nearest 1/64.
306 .sp
307 The default is square (1.0).
308 .sp
309 This option was new in Netpbm 10.38 (March 2007). Before that, the
310 pixels are always square.
311
312
313 .TP
314 \fB-verbose\fP
315 This option causes \fBpamtogif\fP to display information about the
316 conversion process and the image it produces.
317
318
319
320 .UN seealso
321 .SH SEE ALSO
322 .BR "giftopnm" (1)\c
323 \&,
324 .BR "pnmremap" (1)\c
325 \&,
326 .BR "ppmtogif" (1)\c
327 \&,
328
329 \fBgifsicle\fP
330 .UR http://www.lcdf.org/gifsicle
331 http://www.lcdf.org/gifsicle
332 .UE
333 \&,
334 .BR "pnm" (1)\c
335 \&,
336 .BR "pam" (1)\c
337 \&.
338
339 .UN history
340 .SH HISTORY
341 .PP
342 \fBpamtogif\fP was new in Netpbm 10.37 (December 2006). It
343 replaced \fBppmtogif\fP, which created GIF images for Pbmplus/Netpbm
344 users since 1989.
345 .PP
346 The main outward change in the conversion from \fBppmtogif\fP to
347 \fBpamtogif\fP was that \fBpamtogif\fP was able to use transparency
348 information ("alpha channel") in PAM input, whereas with
349 \fBppmtogif\fP, one had to supply the transparency mask in a separate
350 pseudo-PGM image (via the \fB-alpha\fP option).
351 .PP
352 Jef Poskanzer wrote \fBppmtogif\fP in 1989, and it has always been
353 a cornerstone of Pbmplus/Netpbm because GIF is such a popular image
354 format. Jef based the LZW encoding on GIFENCOD by David Rowley <\[email protected]\fP>.
355 Jef included GIFENCOD's GIFCOMPR.C file pretty much whole. Rowley, in
356 turn, adapted the LZW compression code from classic Unix
357 \fBcompress\fP, which used techniques described in IEEE Computer,
358 June 1984.
359 .PP
360 Jef's \fBppmtogif\fP notably lacked the ability to use a
361 transparency mask with it. You could create transparent pixels in a
362 GIF, but only with the \fB-transparent\fP option, which allowed one
363 to specify that all pixels of a certain color in the input were to be
364 transparent. Bryan Henderson added the \fB-alpha\fP option in July
365 2001 so you could supply a mask image that indicates exactly which
366 pixels are to be transparent, and those pixels could have the same
367 color as other opaque ones.
368 .PP
369 Bryan Henderson added another significant piece of code and
370 function in October 2001: the ability to generate a GIF without using
371 the LZW patent -- an uncompressed GIF. This was very important to
372 many people at the time because the GIF patent was still in force, and
373 this allowed them to make an image that any GIF viewer could display,
374 royalty-free. Bryan adapted code from the Independent JPEG Group's
375 \fBdjpeg\fP for that.
376 .PP
377 There is no code in \fBpamtogif\fP from Jef's original, but Jef
378 may still hold copyright over it because of the way in which it evolved.
379 Virtually all of the code in \fBpamtogif\fP was written by Bryan
380 Henderson and contributed to the public domain.
381
382
383 .UN license
384 .SH LICENSE
385 .PP
386 If you use \fBpamtogif\fP without the \fB-nolzw\fP option, you
387 are using a patent on the LZW compression method which is owned by
388 Unisys. The patent has expired (in 2003 in the US and in 2004
389 elsewhere), so it doesn't matter. While the patent was in force, most
390 people who used \fBpamtogif\fP and similar programs did so without a
391 license from Unisys to do so. Unisys typically asked $5000 for a
392 license for trivial use of the patent. Unisys never enforced the
393 patent against trivial users.
394 .PP
395 Rumor has it that IBM also owns or owned a patent covering
396 \fBpamtogif\fP.
397 .PP
398 A replacement for the GIF format that never required any patents to
399 use is the PNG format.
400 .SH DOCUMENT SOURCE
401 This manual page was generated by the Netpbm tool 'makeman' from HTML
402 source. The master documentation is at
403 .IP
404 .B http://netpbm.sourceforge.net/doc/pamtogif.html
405 .PP