ANIGIF 0.01 Grammar Listing Here are the script commands to create animated GIFs. PLEASE see the example script files (*.SCR) in the archive to see how they work. Those items highlighted with (**) MUST be present in EVERY script. Everything else is optional and may appear more than once in the script. For the image raster data and application extension data lines you will need an editor that can edit LONG lines, 750+ characters. TEDIT.EXE or E.EXE that come with OS/2 do the job nicely. Included in the distribution archive is DOCument GIF, you can use it to do most of the work for creating scripts by running it with the -1 switch like so: DOCGIF -1 FOO.GIF > BAR.SCR This command would take FOO.GIF and disassemble it in single line output mode with console output redirected to BAR.SCR. While it doesn't write the script for you, it does take a lot of the work out of it. Legal stuff: Parts of the document were ripped directly from the GIF89a specification. Get it, you ARE going to need it. If any problems arise out of my use of those sections, let me know and I'll remove them. ______________________________________________________________________________ GIF General File Format ______________________________________________________________________________ +-------------------+ | GIF Signature | (**) +-------------------+ | Screen Descriptor | (**) +-------------------+ | Global Color Map | +-------------------+ |... ...| +-------------------+ | Image Descriptor | +-------------------+ | Local Color Map | +-------------------+ | Raster Data | +-------------------+ |... ...| | GIF Terminator | (**) +-------------------+ (**) These all must be present and in this order. All other blocks are optional. The GIF Terminator must be the very last block in the file. ______________________________________________________________________________ Grammar Syntax ______________________________________________________________________________ | = or \ = next line is an extension of current line (**) required ______________________________________________________________________________ Script Commands ______________________________________________________________________________ All commands and data should start out in column 1 of each line. Please see BG.SCR and TEST.SCR for more extensive examples (they will actually create GIF files if you feed them to ANImate GIF). All parameters must be present for all commands. SetDocumentHeader = GIF87a | GIF89a (**) SetDocumentHeader inserts the correct GIF version into the output data stream. Example: SetDocumentHeader = GIF89a --+---+-- SetLogicalScreenDescriptor = \ (**) \ \ \ \ \ \ SetLogicalScreenDescriptor describes the "big picture" for all the images in a file. The parameters are: Raster width in pixels. Raster height in pixels. 0 - 7. See Fig. 1. This is the number of colors in the global color table. 1 = Sorted color table. 0 = Color table not sorted. 0 - 7. See Fig. 1. This is the total number of colors in the palette the image was created from. 1 = Global color table present. 0 = Color table not present. Color index of screen background color. 0 - 255. Setting Colors --------------------------- 0 2 1 4 2 8 3 16 4 32 5 64 6 128 7 256 --------------------------- Fig. 1 --+---+-- SetRGBColorTable = [upto 8 rgb hex values per rgbdef line] EndSet SetRGBColorTable inserts a color table into the output data stream. Example: SetRGBColorTable = 2 000000 FFFFFF EndSet This would insert a color table with 2 entries into the data stream, the colors being black and white. --+---+-- SetImageDescriptor = \ \ \ \ \ \ \ [can set a color table here with `SetRGBColorTable'] [count_of_bytes_on_this_line] [upto 255 byte values per line] EndSet SetImageDescriptor defines the attributes for an image. The parameters are: Column number of the top of the image. Row number of the left side of the image. Width of the image in pixels. Height of image in pixels. 0 - 7. See Fig. 1. This is the number of colors in the local color table. 1 = Local color table is sorted. 0 = Color table not sorted. 1 = Image is interlaced. 0 = Image is not interlaced. 1 = Local color table present. 0 = No local color table. If a local color table needs to be inserted, use SetRGBColorTable to insert it before the raster data. The raster data is presented in a fashion. An example may help: 05 10 1F 2E 3D FF 05 is the number of bytes following, the rest is the actual data. NOTE: all of the entries for these lines are in HEXADECIMAL (base 16) format. Each line will translate into a data sub-block, so please don't succumb to the temptation to make these lines look pretty in your editor by using a number of them with small byte counts. The resultant image will be a valid GIF but space will be wasted in the data stream. --+---+-- SetGraphicControlBlock = \ \ \ \ SetGraphicControlBlock inserts a Graphic Control Block into the output stream. Parameters are: 1 = Image has a transparent color. 0 = No transparent color. 1 = User input wanted. 0 = No input. 0 - 3. Methods are: 0 - None. 1 - Do not dispose (0). 2 - Restore to background. 3 - Restore to previous. 0 - 65535. Delay time, specify the number of 1/100s to wait before processing continues. 0 - 255. Index of the transparent color. --+---+-- SetComment = SetComment inserts a comment into the data stream. Example: SetComment = This is a comment no one will see. Only one line of upto 254 characters may be inserted with the command. --+---+-- SetPlainText = \ \ \ \ \ \ \ [text, only one here, sorry..] SetPlainText inserts a text block that will be rendered on the image. The parameters are: Column number in pixels of the left edge of the text grid. Row number in pixels of the top edge of the text grid. Width in pixels of the text grid. Height in pixels of the text grid. Character cell width in pixels. Character cell height in pixels. Foreground (text) color index. Background color index. One and only one line of text may follow, upto 254 characters. --+---+-- SetApplicationExtension = "Application ID" "Application Authorization Code" [count_of_bytes_on_this_line] [upto 255 byte values per line] EndSet SetApplicationExtension inserts an application defined extension into the output stream. A common use of this is to insert the "Netscape Looping" block for animated GIFs that are seen on many Web pages. Parameters are: "Application ID" 8 character identification string of the application defining this block. "Application Authorization Code" 3 character authentification string used to authenticate the defining application. The data is presented in a fashion. An example may help: 05 10 1F 2E 3D FF 05 is the number of bytes following, the rest is the actual data. NOTE: all of the entries for these lines are in HEXADECIMAL (base 16) format. Each line will translate into a data sub-block, so please don't succumb to the temptation to make these lines look pretty in your editor by using a number of them with small byte counts. The resultant file will be valid but, space will be wasted in the data stream. --+---+-- SetNetscapeLoop = SetNetscapeLoop inserts the Netscape 2.0 loop block into the output stream. Its one and only argument is the number of times you want the animation to repeat. Currently I believe all versions of Netscape ignore this (please let me know if this has been fixed). However, you should still set this to reasonable value. --+---+-- SetEOI (**) SetEOI inserts the End Of Information block into the output stream. This MUST be the last block in your script. --+---+--