.TL Ppmtogif User Manual .SH 1 ppmtogif .LP Updated: 15 September 2002 .br Table Of Contents .SH 2 NAME .LP ppmtogif - convert a PPM image to a GIF image .SH 2 SYNOPSIS .LP \fBppmtogif\fR [\fB-interlace\fR] [\fB-sort\fR] [\fB-mapfile\fR \fImapfile\fR] .br [\fB-transparent=\fR[\fB=\fR]\fIcolor\fR] [\fB-alpha=\fR\fIpgmfile\fR] [\fB-comment=\fR\fItext\fR] [\fB-nolzw\fR] .br [\fIppmfile\fR] .LP All options can be abbreviated to their shortest unique prefix. You may use two hyphens instead of one to designate an option. You may use either white space or equals signs between an option name and its value. .SH 2 DESCRIPTION .LP .LP This program is part of Netpbm. .LP \fBppmtogif\fR reads a PPM iamge as input and produces a GIF file as output. .LP This program creates only individual GIF images. To combine multiple GIF images into an animated GIF, use \fBgifsicle\fR (not part of the Netpbm package). .LP \fBppmtogif\fR creates either an original GIF87 format GIF file or the newer GIF89 format. It creates GIF89 when you request features that were new with GIF89, to wit the \fB-transparent\fR or \fB-comment\fR options. Otherwise, it creates GIF87. Really old GIF readers conceivably could not recognize GIF89. .SH 2 OPTIONS .LP .RS .IP "\fB-interlace\fR" Produce an interlaced GIF file. .IP "\fB-sort\fR" Produce a GIF file with a sorted color map. .IP "\fB-mapfile=\fR\fImapfile\fR" .LP Use the colors found in the file \fImapfile\fR to create the colormap in the GIF file, instead of the colors from \fIppmfile\fR. \fImapfile\fR can be any PPM file; all that matters is the colors in it. If the colors in \fIppmfile\fR do not match those in \fImapfile\fR, \fBppmtogif\fR matches them to a "best match." You can obtain a much better result by using \fBpnmremap\fR to change the colors in the input to those in the map file. .LP The \fImapfile\fR file is not a palette file, just an image whose colors you want to use. The order of colors in the GIF palette have nothing to do with where they appear in the \fImapfile\fR image, and duplication of colors in the image is irrelevant. .IP "\fB-transparent=\fR\fIcolor\fR" \fBppmtogif\fR marks the specified color as transparent in the GIF image. .LP If you don't specify \fB-transparent\fR, \fBppmtogif\fR does not mark any color transparent (except as indicated by the \fB-alpha\fR option). .LP Specify the color (\fIcolor\fR) as described for the argument of the \fBppm_parsecolor()\fR library routine. If the color you specify is not present in the image, \fBppmtogif\fR selects instead the color in the image that is closest to the one you specify. Closeness is measured as a cartesian distance between colors in RGB space. If multiple colors are equidistant, \fBppmtogif\fR chooses one of them arbitrarily. .LP However, if you prefix your color specification with "=", e.g. \fB-transparent==red\fR, only the exact color you specify will be transparent. If that color does not appear in the image, there will be no transparency. \fBppmtogif\fR issues an information message when this is the case. .LP You cannot specify both \fB-transparent\fR and \fB-alpha\fR. .IP "\fB-alpha=\fR\fIpgmfile\fR" This option names a PGM file that contains an alpha mask for the image. \fBppmtogif\fR creates fully transparent pixels wherever the alpha mask indicates transparency greater than 50%. The color of those pixels is that specified by the \fB-alphacolor\fR option, or black by default. .LP To do this, \fBppmtogif\fR creates an entry in the GIF colormap in addition to the entries for colors that are actually in the image. It marks that colormap entry as transparent and uses that colormap index in the output image to create a transparent pixel. .LP The alpha image must be the same dimensions as the input image, but may have any maxval. White means opaque and black means transparent. .LP You cannot specify both \fB-transparent\fR and \fB-alpha\fR. .IP "\fB-alphacolor\fR" See \fB-alpha\fR. .IP "\fB-comment=\fR\fItext\fR" Include a comment in the GIF output with comment text \fItext\fR. .LP Without this option, there are no comments in the output. .LP Note that in a command shell, you'll have to use quotation marks around \fItext\fR if it contains characters (e.g. space) that would make the shell think it is multiple arguments: .DS L $ ppmtogif -comment "this is a comment" xxx.gif .DE .IP "\fB-nolzw\fR" .LP This option is mainly of historical interest -- it involves use of a patent that is now expired. .LP This option causes the GIF output, and thus \fBppmtogif\fR, not to use LZW (Lempel-Ziv) compression. As a result, the image file is larger and, before the patent expired, no royalties would be owed to the holder of the patent on LZW. See the section LICENSE below. .LP LZW is a method for combining the information from multiple pixels into a single GIF code. With the \fB-nolzw\fR option, \fBppmtogif\fR creates one GIF code per pixel, so it is not doing any compression and not using LZW. However, any GIF decoder, whether it uses an LZW decompressor or not, will correctly decode this uncompressed format. An LZW decompressor would see this as a particular case of LZW compression. .LP Note that if someone uses an LZW decompressor such as the one in \fBgiftopnm\fR or pretty much any graphics display program to process the output of \fBppmtogif -nolzw \fR, he is then using the LZW patent. But the patent holder expressed far less interest in enforcing the patent on decoding than on encoding. .RE .SH 2 SEE ALSO .LP \fBgiftopnm\fR, \fBppmquant\fR, \fBpngtopnm\fR, \fBgifsicle\fR , \fBppm\fR. .SH 2 AUTHOR .LP .LP Based on GIFENCOD by David Rowley . Lempel-Ziv compression based on "compress". .LP The non-LZW format is generated by code based on \fBdjpeg\fR by the Independent Jpeg Group. .LP Copyright (C) 1989 by Jef Poskanzer. .SH 2 LICENSE .LP .LP If you use \fBppmtogif\fR without the \fB-nolzw\fR option, you are using a patent on the LZW compression method which is owned by Unisys. The patent has expired (in 2003 in the US and in 2004 elsewhere), so it doesn't matter. While the patent was in force, most people who used \fBppmtogif\fR and similar programs did so without a license from Unisys to do so. Unisys typically asked $5000 for a license for trivial use of the patent. Unisys never enforced the patent against trivial users. .LP Rumor has it that IBM also owns or owned a patent covering \fBppmtogif\fR. .LP A replacement for the GIF format that never required any patents to use is the PNG format. .br \l'5i' .SH 2 Table Of Contents .LP .IP \(bu NAME .IP \(bu SYNOPSIS .IP \(bu DESCRIPTION .IP \(bu OPTIONS .IP \(bu SEE ALSO .IP \(bu AUTHOR .IP \(bu LICENSE .LP