Kiwi's Home Page: [GIFMerge] Merge single GIFs into an GIF89a Animation, V1.33 - July 1996 [Background] [C-Source] [Usage] [Sample Animations] [Manipulation Offset Position] [Usage Hints] [Complex Animations] [Backup Advise] [Trouble Shooting] [Known Problems] Background gifmerge is based on txtmerge written by Mark Podlipec, part of XANIM distribution. 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): ------------------------------------------ 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 be executed. 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. ------------------------------------------ For more specific infos look at Royal Frazier's GIF Making: Looping. C-Source 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 doing some improvements (colormap checking and optimizations), soon (end of year) and new version, probaly V1.40 will be out. * Precompiled: o SunOS4: gifmerge V1.33 compiled by myself o SGI: gifmerge V1.33 provided by Jason Burns (jason@sgi.3ws.com) o HP-UX: gifmerge V1.33 ported by Stefan Morgenroth o ELF-Linux: gifmerge V1.33 compiled by Terry Jones (terry@teclata.es) o OS/2: gifmerge_os2.zip ported by Stefan Morgenroth (morgenroth@tu-harburg.d400.de) o Atari-ST: gifmerge-1.33-bin.tar.gz compiled by Schmidt Jan Paul (Jan.P.Schmidt@mni.fh-giessen.de) o DOS/NT: gifmerge V1.33 compiled by Soeren Mueller (soeren@incases.com) Usage === GIFMerge Rev 1.33 (C) 1991,1992 by Mark Podlipec Improvements by Rene K. Mueller 1996 Usage: gifmerge [-,,] [-] [-l] *.gif > anim.gif -,, set transparency, ie -192,192,192, default: no transparency -notransp set transparency off (after you used -r,g,b before) - set delay of between images in 1/100th secs, ie -100 default 50 (0.5secs) -l set loop counter, ie -l0 (ever) or -l1000, default no loops -d set disposal 0 = no action, 1 = no dispose, 2 = restore background (default) 3 = restore previous -pos, set offset position for image -nopos reset offset position (default) You have two images like this: [Image] [Image] gifmerge -192,192,192 -l0 -50 perlredb.gif perlgrey.gif > perlredblink.gif Gives you [Image] gifmerge -192,192,192 -l0 -50 perlredb.gif -10 perlgrey.gif > perlredblink2.gif Gives you [Image] Sample Animations Sample blinking LEDs: [Image] [Image] [Image] [Image] [Image] each has 2 frames 0.5s delay [Image] 4 frames, delays: 1x 1.0s and 3x 0.1s more coming soon ... Manipulation Offset Position You have [Image] and [Image] 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: [Image] [Image] disposal-mode = 0 disposal-mode = 1 [Image] [Image] 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 ... Usage Hints 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 setting: 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 position offset). Complex Animations [Image] 46 frames, 0.1s delay [Image] 20 frames, 0.1s delay Sphere and Box (450K) 50 frames, 0.1s delay more coming soon ... Very Very Complex Animations [Image] Was programmed for Spirit-WWW using quite a bunch of perl-scripts as you can assume, over 135 GIFs merged but very small ones, finally only 25K size. Looks like an java applet, but isn't one ;-) A gallery with GIF89 animations you find at Royal Frazier's Animation Gallery. Backup Advise Always keep backup of your GIFs you build your animation ... 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 cases. 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). 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. Netscape-3.0b4 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. Netscape-3.0b5 Some fixes since b4. --------------------------------------------------------- Accesses since Feb 5, 1996: [Image] --------------------------------------------------------- [Background] [C-Source] [Usage] [Sample Animations] [Manipulation Offset Position] [Usage Hints] [Complex Animations] [Backup Advise] [Trouble Shooting] [Known Problems] ---------------------------------------------------------------------------- [Image] kiwi@iis.ee.ethz.ch