1GIF2PNG(1) GIF2PNG(1)
2
3
4
6 gif2png - convert GIFs to PNGs
7
9 gif2png [-bdfghinprsvwO] [file.[gif]...]
10
11
13 The gif2png program converts files in the obsolescent and patent-encum‐
14 bered Graphic Interchange Format (GIF) to Portable Network Graphics
15 (PNG) format, an open W3C standard.
16
17
18 Normally gif2png converts each file named on the command line, leaving
19 the original in place. If a name does not have a .gif extension, the
20 unmodified name will be tried first, followed by the name with .gif
21 appended. For each file named `foo.gif', a foo.png will be created.
22
23
24 When a multi-image GIF file named foo.gif is converted, gif2png creates
25 multiple PNG files, each containing one frame; their names will be
26 foo.png, foo.p01, foo.p02 etc.
27
28
29 If no source files are specified and stdin is a terminal, gif2png lists
30 a usage summary and version information, then exits.
31
32
33 If no source files are specified, and stdin is a device or pipe, stdin
34 is converted to noname.png. (The program can't be a normal
35 stdin-to-stdout filter because of the possibility that the input GIF
36 might have multiple images).
37
38
39 However, if filter mode is forced (with -f) stdin will be converted to
40 stdout, with gif2png returning an error code if the GIF is multi-image.
41
42
43 The program will preserve the information contained in a GIF file as
44 closely as possible, including GIF comment and application-data exten‐
45 sion blocks. All graphics data (pixels, RGB color tables) will be con‐
46 verted without loss of information. Transparency is also preserved.
47 There is one exception; GIF plain-text extensions are skipped.
48
49
50 The program automatically converts interlaced GIFs to interlaced PNGs.
51 It detects images in which all colors are gray (equal R, G, and B val‐
52 ues) and converts such images to PNG grayscale. Other images are con‐
53 verted to use the PNG palette type. Duplicate color entries are
54 silently preserved. Unused color-table entries cause an error message.
55
56
57 The action of the program can be modified with the following com‐
58 mand-line switches:
59
60
61 -b {#}RRGGBB
62 Background. Replace transparent pixels with given RGB value, six
63 hexadecimal digits interpreted as two hexits each of red, green,
64 and blue value. The value may optionally be led with a #,
65 HTML-style.
66
67
68 -d Delete source GIF files after successful conversion.
69
70
71 -f Filter mode. Convert GIF on stdin to PNG on stdout, return error
72 if the GIF is multi-image.
73
74
75 -g Write gamma=1/2.2 and sRGB chunks in the PNG.
76
77
78 -h Generate PNG color-frequency histogram chunks into converted
79 color files.
80
81
82 -i Force conversion to interlaced PNG files.
83
84
85 -n Force conversion to non-interlaced PNG files.
86
87
88 -p Display progress of PNG writing.
89
90
91 -r Try to recover data from corrupted GIF files.
92
93
94 -s Do not translate the GIF Software chunk to a PNG annotation.
95
96
97 -t Change behavior of web-probe (-w) mode to accept GIFs with
98 transparency.
99
100
101 -v Verbose mode; show summary line, -vv enables conversion-statis‐
102 tics and debugging messages.
103
104
105 -w Web-probe switch; list GIFs that do not have multiple images or
106 transparency to stdout. GIFs that fail this filter cause error
107 messages to stderr.
108
109
110 -O Optimize; remove unused color-table entries. Normally these
111 trigger an error message and disable -d (but conversion is com‐
112 pleted anyway). Also, use zlib compression level 9 (best com‐
113 pression) instead of the default level. The recovery algorithm
114 enabled by -r is as follows: Unused color table entries will not
115 trigger an error message as they normally do, but will still be
116 preserved unless -O is also on, in which case they will be dis‐
117 carded. Missing color tables will be patched with a default that
118 puts black at index 0, white at index 1, and supplies red,
119 green, blue, yellow, purple and cyan as the remaining color val‐
120 ues. Missing image pixels will be set to 0. Unrecognized or cor‐
121 rupted extensions will be discarded.
122
123
125 Naively converting all your GIFs at one go with gif2png is not likely
126 to give you the results you want. The problem is not with PNG itself or
127 with gif2png, but with the poor-to-nonexistent support for PNG trans‐
128 parency and animation in most browsers.
129
130
131 The web-probe switch is intended to be used with scripts for converting
132 web sites. All PNGs generated from the pathnames it returns will be
133 properly rendered in Netscape Navigator 4.04+, Internet Explorer ver‐
134 sions 4.0b1+, and all other current web browsers. Note: in future
135 releases of gif2png, the meaning of this switch may change to reflect
136 the capabilities of prevalent browsers.
137
138
140 The GIF format is encumbered by a Unisys patent (see <http://www.del‐
141 phion.com/details?&pn10=US04464650>) for the Lempel-Ziv-Welch compres‐
142 sion algorithm. Use of any GIF image generator not licensed by Unisys
143 can make you liable to lawsuit. Unisys apparently refuses to issue
144 licenses for use of LZW in open-source programs, and in 1999 stated
145 that its policy is to require a $5000 fee from websites that carry GIF
146 images made by unlicensed software -- even nonprofit websites created
147 and displayed with free software. See <http://corp2.unisys.com/Lead‐
148 Story/lzw-license.html> for details.
149
150
151 The patent probably does not cover LZW decompressors such as the one
152 gif2png uses; legal opinions are divided on this, there has been no
153 court test, and Unisys refuses to commit itself. It is possible that
154 you may be liable if you distribute gif2png in a commercial program, or
155 distribute gif2png on a for-profit basis.
156
157
158 For a history of the GIF patent controversy, see
159 <http://lpf.ai.mit.edu/Patents/Gif/Gif.html>. To avoid legal problems,
160 it would be a good idea to convert all GIFs on your websites and else‐
161 where to PNGs without delay. See <http://burnallgifs.org/> for discus‐
162 sion.
163
164
166 Copies of the GIF89 specification are widely available on the Web;
167 search for "GRAPHICS INTERCHANGE FORMAT". The Graphics Interchange For‐
168 mat(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is
169 a Service Mark property of CompuServe Incorporated.
170
171
172 The PNG home site at <http://www.libpng.org/pub/png/> has very complete
173 information on the PNG standard, PNG libraries, and PNG tools.
174
175
177 web2png(1)
178
179
181 Code by Alexander Lehmann <alex@hal.rhein-main.de>, 1995. Auto-inter‐
182 lace conversion and tRNS optimization by Greg Roelofs <newt@pobox.com>,
183 1999. Man page, -O, -w, and production packaging by Eric S. Raymond
184 <esr@thyrsus.com>, 1999.
185
186
187
188
189 GIF2PNG(1)