Last update 2001/12/07
The Labs - Design & Functionality For The Net
Merge GIFs to a GIF animation
$MyVersion: 1.330 - Mon Jul 20 08:30:23 EDT 1998 - kiwi$
written by René K. Müller
- Sample Animations
- Manipulation Offset Position
- Usage Hints
- Complex Animations
- Very Very Complex Animations
- Backup Advise
- Trouble Shooting
- Known Problems
- Related Resources
gifmerge is based on txtmerge written by Mark Podlipec, part of
Based on infos Royal Frazier's GIF89a Animation Page
I improved txtmerge to gifmerge.
gifmerge uses GIF89a extensions, as well the recent developed application
extensions supported by Netscape-2.0 with n-loops. For details on
GIF89a see at the GIF89a Specifications.
An excerpt of the Application Extension defined by Netscape (from Understanding GIF89a):
For more specific infos look at Royal Frazier's GIF Making: Looping.
Netscape Navigator has an Application Extension Block that tells Navigator to loop the entire
GIF file. The Netscape block MUST APPEAR IMMEDIATELY AFTER THE GLOBAL
COLOR TABLE OF THE LOGICAL SCREEN DESCRIPTOR. Only Navigator 2.0 Beta4 or
better will recognize this Extension block. The block is 19 bytes long composed of: (note:
hexidecimal equivalent supplied for programmers)
byte 1 : 33 (hex 0x21) GIF Extension code
byte 2 : 255 (hex 0xFF) Application Extension Label
byte 3 : 11 (hex (0x0B) Length of Application Block
(eleven bytes of data to follow)
bytes 4 to 11 : "NETSCAPE"
bytes 12 to 14 : "2.0"
byte 15 : 3 (hex 0x03) Length of Data Sub-Block
(three bytes of data to follow)
byte 16 : 1 (hex 0x01)
bytes 17 to 18 : 0 to 65535, an unsigned integer in
lo-hi byte format. This indicate the
number of iterations the loop should
bytes 19 : 0 (hex 0x00) a Data Sub-block Terminator.
As of Beta5, the iteration count is ignored and the loop is infinite (an iteration count of zero
indicates infinite). I strongly suggest you code the count to be accurate, so that when iterations
begin working your GIF will not need to be modified. Technically that is all that needs to be done
with this block. More about looping later in the tutorial.
Get the UNIX tar file:
- gifmerge.tar.gz V1.33 (July 22, 1996).
- Note: If you consider to improve gifmerge, please contact
me beforehand, as several people already done some improvements (colormap checking and optimizations).
Soon and new version, probably V1.40 will be released.
GIFSicle which provides
frame extraction and colormap optimization and all
features GIFMerge has as well.
=== GIFMerge Rev 1.33 (C) 1991,1992 by Mark Podlipec
Improvements by Rene K. Mueller 1996
Usage: gifmerge [-<r>,<g>,<b>] [-<delay>] [-l<loops>] *.gif > anim.gif
-<r>,<g>,<b> set transparency, ie -192,192,192, default: no transparency
-notransp set transparency off (after you used -r,g,b before)
-<delay> set delay of between images in 1/100th secs, ie -100
default 50 (0.5secs)
-l<loops> set loop counter, ie -l0 (ever) or -l1000, default no loops
-d<disposal> set disposal 0 = no action, 1 = no dispose,
2 = restore background (default)
3 = restore previous
-pos<x>,<y> set offset position for image
-nopos reset offset position (default)
You have two images like this:
gifmerge -192,192,192 -l0 -50 perlredb.gif perlgrey.gif > perlredblink.gif
gifmerge -192,192,192 -l0 -50 perlredb.gif -10 perlgrey.gif > perlredblink2.gif
|GIFMerge4. Sample Animations
Sample blinking LEDs:
each has 2 frames 0.5s delay
4 frames, delays: 1x 1.0s and 3x 0.1s
more coming soon ...
|GIFMerge5. Manipulation Offset Position
You have and
and we call
gifmerge -ddisposal-mode -0,0,255 -l0 -50 a.gif -pos20,10 b.gif \
-pos25,10 b.gif -pos30,15 b.gif -pos35,25 b.gif > c.gif
disposal-mode is 0, 1, 2 or 3 (like -d0). We get following:
disposal-mode = 0
disposal-mode = 1
disposal-mode = 2
disposal-mode = 3
This might be very helpful (disposal-mode 0, 1 and 3) to make an animation within a big
first image, and then take smaller images to make local animations within
the bigger one. Disposal-mode 2 is good for small animation moving over
a large area of the screen without particular pictural backround.
Note: Negative coordinates seem not yet supported by Netscape-3.0b5
(the picture with negative coords will not displayed).
Btw, Netscape 2.0/2.01 and 3.0 beta 1-5 do not support DisposalMode 1 & 3, only 0 and 2 (default).
other samples later ...
The option -r,g,b like -192,192,192 sets transparency,
in case you have a sequence of GIF, where some have transparency, and
some have not, so use -notransp to switch off the last -r,g,b
gifmerge -192,192,192 a.gif b.gif c.gif -notransp d.gif e.gif > z.gif
Btw, if the transparency is defined, but not found in the colormap, so
the closest color is assumed as transparency.
If you use -pos (overrides offset position), then the coordinates remain for all further
GIF you add in the animation:
gifmerge default.gif -pos10,10 a.gif b.gif > c.gif
b.gif will have 10,10 as offset as well. Use -nopos to switch off
any positioning or use -pos0,0 has same effect, unless b.gif has
already an internal offset defined (some tools allow to create GIF with
|GIFMerge7. Complex Animations
20 frames, 0.1s delay
|GIFMerge8. Very Very Complex Animations
An event-banner as animation.
I programmed for SpiritWeb using quite a bunch of perl-scripts as you may assume, over 135 GIFs merged but very small ones, finally only 25K size.
Looks like a Java applet, but isn't one ;-)
A gallery with GIF89 animations you can find at
Royal Frazier's Animation Gallery.
Always keep backups of the GIFs you build your animation with ...
|GIFMerge10. Trouble Shooting
I received several emails from people having difficulties with gifmerge,
as the animation didn't run. If this happens, make sure your GIFs are
fully correct as some tools create strange GIFs which aren't fully
standard. Use xv the famous X11 image viewer and load/save all
GIFs, and try again with gifmerge. So far this helped in all
Beside, Bob O'Neill informed me, gifmerge creates better animation
when the input GIF pictures are not interlaced, look if possible to
feed gifmerge with GIF87 pics (and not GIF89a).
|GIFMerge11. Known Problems
- Netscape 2.01 and 2.02:
I noticed that the counter-loop doesn't work at Netscape2.0, has a
never-ending loop if you set -lnum. Royal Frazier wrote, that
Netscape-2.0 just ignors the loop counter in their version, but
maybe next version 2.1 they may support it.
Also, Netscape-2.0 seems to shows the animations as busy (comets on the "N" right
upper corner of your browser) as well indicates "Reading document ..." on the
bottom of your browser, which both are quite distracting for readers.
When you go back to a page (using Back-Button) which
has GIF89a animations with loops, Netscape2.0 does show only few pictures
as animations, some are freezed.
Beside, if you leave a page with some GIF89a animations (with loops as well), to another page,
Netscape-2.0 does not show the page while loading as usual.
And finally, Netscape-2.0 gets problems when two or more windows are open with
GIF89a animations, you assume right: it crashs in some cases.
- Netscape 3.0b2:
- Same as Netscape 2.0.1 except less crashing
- Netscape 3.0b3:
- Has major problems with animated GIF enclosed in this page
(the two last longer animations), I also used whirlgif (another GIF merge-tool)
and Netscape-3.0b3 had the same problems, so it seems it's a problem of Netscape
and not of the animation tool.
- Runs animations again (ughhh), but I noticed
that jumping with local references (href="#xyz") stops
animations, and a Reload of the page starts all animations again.
Beside, also has problems with transparency in animated and non-animated
GIF89a, earlier beta-version hasn't had this.
- Some fixes since b4.
- All fixed, no known problems
- IE3.x or 4.x (dump it and support Netscape)
|GIFMerge12. Related Resources
Accesses since Feb 5, 1996:
Hipocrisy of the finest:
"I agree that no single company can create all the hardware and software. Openness is central because it's the foundation of choice."
-- Steve Balmer (Microsoft) blaming Apple regarding iPhone, February 18, 2009
"Things work better when hardware and software are considered together, [..]. We control it all, we design it all, and we manufacture it all ourselves."Last update 2001/12/07
-- Steve Balmer announcing Windows 8 Tablet, June 19, 2012
All Rights Reserved - (C) 1997 - 2012 by The Labs.Com