1GIF2PNG(1) Graphics GIF2PNG(1)
2
3
4
6 gif2png - convert GIFs to PNGs
7
9 gif2png [-bdfghimnprsvwO] [file.[gif]...]
10
12 The gif2png program converts files in the obsolescent Graphic
13 Interchange Format (GIF) to Portable Network Graphics (PNG) format, an
14 open W3C standard.
15
16 Normally gif2png converts each file named on the command line, leaving
17 the original in place. If a name does not have a .gif extension, the
18 unmodified name will be tried first, followed by the name with .gif
19 appended. For each file named foo.gif, a foo.png will be created.
20
21 When a multi-image GIF file named foo.gif is converted, gif2png creates
22 multiple PNG files, each containing one frame; their names will be
23 foo.png, foo.p01, foo.p02 etc.
24
25 If no source files are specified and stdin is a terminal, gif2png lists
26 a usage summary and version information, then exits.
27
28 If no source files are specified, and stdin is a device or pipe, stdin
29 is converted to noname.png. (The program can't be a normal
30 stdin-to-stdout filter because of the possibility that the input GIF
31 might have multiple images).
32
33 However, if filter mode is forced (with -f) stdin will be converted to
34 stdout, with gif2png returning an error code if the GIF is multi-image.
35
36 The program will preserve the information contained in a GIF file as
37 closely as possible, including GIF comment and application-data
38 extension blocks. All graphics data (pixels, RGB color tables) will be
39 converted without loss of information. Transparency is also preserved.
40 There is one exception; GIF plain-text extensions are skipped.
41
42 The program automatically converts interlaced GIFs to interlaced PNGs.
43 It detects images in which all colors are gray (equal R, G, and B
44 values) and converts such images to PNG grayscale. Other images are
45 converted to use the PNG palette type. Duplicate color entries are
46 silently preserved. Unused color-table entries cause an error message.
47
48 The action of the program can be modified with the following
49 command-line switches:
50
51 -b {#}RRGGBB
52 Background. Replace transparent pixels with given RGB value, six
53 hexadecimal digits interpreted as two hexits each of red, green,
54 and blue value. The value may optionally be led with a #,
55 HTML-style.
56
57 -d
58 Delete source GIF files after successful conversion.
59
60 -f
61 Filter mode. Convert GIF on stdin to PNG on stdout, return error if
62 the GIF is multi-image.
63
64 -m
65 Preserve file modification time. The PNG output gets the mod time
66 of the input file, not the time it was converted.
67
68 -g
69 Write gamma=1/2.2 and sRGB chunks in the PNG.
70
71 -h
72 Generate PNG color-frequency histogram chunks into converted color
73 files.
74
75 -i
76 Force conversion to interlaced PNG files.
77
78 -n
79 Force conversion to non-interlaced PNG files.
80
81 -p
82 Display progress of PNG writing.
83
84 -r
85 Try to recover data from corrupted GIF files.
86
87 The recovery algorithm enabled by -r is as follows: Unused color
88 table entries will not trigger an error message as they normally
89 do, but will still be preserved unless -O is also on, in which case
90 they will be discarded. Missing color tables will be patched with a
91 default that puts black at index 0, white at index 1, and supplies
92 red, green, blue, yellow, purple and cyan as the remaining color
93 values. Missing image pixels will be set to 0. Unrecognized or
94 corrupted extensions will be discarded.
95
96 -s
97 Do not translate the GIF Software chunk to a PNG annotation.
98
99 -v
100 Verbose mode; show summary line, -vv enables conversion-statistics
101 and debugging messages.
102
103 -w
104 Web-probe switch; list GIFs that do not have multiple images to
105 stdout. GIFs that fail this filter cause error messages to stderr.
106
107 -O
108 Optimize; remove unused color-table entries. Normally these trigger
109 an error message and disable -d (but conversion is completed
110 anyway). Also, use zlib compression level 9 (best compression)
111 instead of the default level.
112
114 A sufficiently malformed GIF can confuse this program seriously enough
115 to segfault it. If this happens while processing multiple GIFs,
116 conversion of the batch will be interrupted.
117
118 Naively converting all your GIFs at one go with gif2png is not likely
119 to give you the results you want. Animated GIFs cannot be translated to
120 PNG, which is a single-image format.
121
122 The web-probe switch is intended to be used with scripts for converting
123 web sites. In versions of this tool up to 2.5.2 it filtered out GIFs
124 with transparency as well as GIFs with animations, but support for PNG
125 transparency has been universal in browsers since about 2006.
126
128 Normally returns 0 for successful comp[letion. A return of 1 is a
129 recoverable error (batch processing continues), A return of 2 is an
130 unrecoverable error.
131
133 Copies of the GIF89 specification are widely available on the Web;
134 search for "GRAPHICS INTERCHANGE FORMAT". The Graphics Interchange
135 Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm)
136 is a Service Mark property of CompuServe Incorporated. The GIF format
137 was formerly covered by a blocking patent on LZW compression, but it
138 expired in June 2003.
139
140 The PNG home site at <http://www.libpng.org/pub/png/> has very complete
141 information on the PNG standard, PNG libraries, and PNG tools.
142
144 web2png(1)
145
147 Code by Alexander Lehmann <alex@hal.rhein-main.de>, 1995.
148 Auto-interlace conversion and tRNS optimization by Greg Roelofs
149 <newt@pobox.com>, 1999. Man page, -O, -w, and production packaging by
150 Eric S. Raymond <esr@thyrsus.com>, 1999. -m option by Steve Ward, 2012.
151
152
153
154gif2png 06/20/2019 GIF2PNG(1)