The GifComponents namespace contains classes for encoding and decoding animated Graphics Interchange Format files and streams.
|C#||Visual Basic||Visual C++|
TODO: remove support for transparency until it's understood better? Class AnimatedGifEncoder - Encodes a GIF file consisting of one or more frames. Instantiate the encoder using the constructor, call the AddFrame to add as many GifFrames as desired, then call the WriteToStream or WriteToFile method to create the animation. No copyright asserted on the source code of this class. May be used for any purpose, however, refer to the Unisys LZW patent for restrictions on use of the associated LZWEncoder class. Please forward any corrections to firstname.lastname@example.org. @author Kevin Weiner, FM Software @version 1.03 November 2003 Modified by Phil Garcia (email@example.com) 1. Add support to output the Gif to a MemoryStream (9/2/2005) Modified by Simon Bridewell, June-August 2009: Downloaded from http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip * Corrected FxCop code analysis errors. * Documentation comments converted to .net XML comments. * Refactored so that all properties are set in the constructor. * Writing of GIF components to the output stream delegated to the classes for those components. * Added option to use a global colour table instead of local colour tables. * Added support for colour tables with fewer than 256 colours * Colour quantization only performed for animations with more than 256 colours.
The Application Extension contains application-specific information; it conforms with the extension block syntax, and its block label is 0xFF. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 26.
A global or local colour table which forms part of a GIF data stream.
Enumeration of strategies for including colour tables when encoding a GIF file.
A data sub-block to form part of a Graphics Interchange Format data stream. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 15.
Enumeration of disposal methods that can be found in a Graphic Control Extension. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 23.
The error state of a GIF data stream, or of one of the components of the stream.
The base class for a component of a Graphics Interchange File data stream.
The status of a component in a GIF data stream which is being decoded. Includes a member of the GifDecoderStatus enumeration, and some text to describe what (if anything) is wrong.
Class GifDecoder - Decodes a GIF file into one or more frames and exposes its properties, components and any error states. No copyright asserted on the source code of this class. May be used for any purpose, however, refer to the Unisys LZW patent for any additional restrictions. Please forward any corrections to firstname.lastname@example.org. @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's ImageMagick. @version 1.03 November 2003 Modified by Simon Bridewell, June-July 2009: Downloaded from http://www.thinkedge.com/blogengine/post/2008/02/20/Animated-GIF-Encoder-for-NET-Update.aspx http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip 1. Adapted for FxCop code analysis compliance and documentation comments converted to .net XML comments. 2. Added comments relating the properties to data items specified in http://www.w3.org/Graphics/GIF/spec-gif89a.txt 3. Added property getters to expose the components of the GIF file. 4. Refactored large amounts of functionality into separate classes which encapsulate the types of the components of a GIF file. 5. Removed all private declarations which are not components of a GIF file.
A single image frame from a GIF file. Originally a nested class within the GifDecoder class by Kevin Weiner. Downloaded from http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip Amended by Simon Bridewell June-November 2009: 1. Made member variables private. 2. Added various properties to expose all the elements of the GifFrame. 3. Added constructors for use in both encoding and decoding. 4. Derive from GifComponent. 5. Added FromStream method
The header section of a Graphics Interchange Format stream. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 17.
The Graphic Control Extension contains parameters used when processing a graphic rendering block. The scope of this extension is the first graphic rendering block to follow. The extension contains only one data sub-block. This block is OPTIONAL; at most one Graphic Control Extension may precede a graphic rendering block. This is the only limit to the number of Graphic Control Extensions that may be contained in a Data Stream.
Describes a single image within a Graphics Interchange Format data stream. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 20.
A collection of the indices of the colours of an image's pixels within a colour table.
The Logical Screen Descriptor component of a Graphics Interchange Format stream. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 18.
GIFCOMPR.C - GIF Image compression routines Lempel-Ziv compression based on 'compress'. GIF modifications by David Rowley (email@example.com) Adapted from Jef Poskanzer's Java port by way of J. M. G. Elliott. K Weiner 12/00 GIF Image compression - modified 'compress' Based on: compress.c - File compression ala IEEE Computer, June 1984. By Authors: Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) Jim McKie (decvax!mcvax!jim) Steve Davies (decvax!vax135!petsd!peora!srd) Ken Turkowski (decvax!decwrl!turtlevax!ken) James A. Woods (decvax!ihnp4!ames!jaw) Joe Orost (decvax!vax135!petsd!joe) Algorithm: use open addressing double hashing (no chaining) on the prefix code / next character combination. We do a variant of Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime secondary probe. Here, the modular division first probe is gives way to a faster exclusive-or manipulation. Also do block compression with an adaptive reset, whereby the code table is cleared when the compression ratio decreases, but after the table fills. The variable-length output codes are re-sized at this point, and a special CLEAR code is generated for the decompressor. Late addition: construct the table according to file size for noticeable speed improvement on small files. Please direct questions about this implementation to ames!jaw. Inputs: code: A n_bits-bit integer. If == -1, then EOF. This assumes that n_bits =< wordsize - 1. Outputs: Outputs code to the file. Assumptions: Chars are 8 bits long. Algorithm: Maintain a BITS character long buffer (so that 8 codes will fit in it exactly). Use the VAX insv instruction to insert each code in turn. When the buffer fills up empty it and start over. Modified by Simon Bridewell, June-August 2009: Downloaded from http://www.thinkedge.com/blogengine/post/2008/02/20/Animated-GIF-Encoder-for-NET-Update.aspx http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip * Corrected FxCop code analysis errors. * Documentation comments converted to .net XML comments. * Updated to use .net 2.0 generics - use List instead of byte TODO: maybe this belongs in TableBasedImageData?
An application extension which controls the number of times an animation should be displayed. See http://www.let.rug.nl/~kleiweg/gif/netscape.html for format
NeuQuant Neural-Net Quantization Algorithm ------------------------------------------ Copyright (c) 1994 Anthony Dekker NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See "Kohonen neural networks for optimal colour quantization" in "Network: Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of the algorithm. Any party obtaining a copy of these files from the author, directly or indirectly, is granted, free of charge, a full and unrestricted irrevocable, world-wide, paid up, royalty-free, nonexclusive right and license to deal in this software and documentation files (the "Software"), including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons who receive copies from any such party to do so, with the only requirement being that this copyright notice remain intact. Ported to Java 12/00 K Weiner Modified by Simon Bridewell, June 2009: Downloaded from http://www.thinkedge.com/BlogEngine/file.axd?file=NGif_src2.zip Adapted by for FxCop code analysis compliance and documentation comments converted to .net XML comments. Updated to use .net 2.0 generics - use List instead of byte
Represents a byte of data in a GIF data stream which contains a number of data items.
The result of analysing the pixels in an image or a collection of images. Creates a colour table containing the colours in the image or images, and a collection of indexed pixels for each image containing the indices of each pixel's colour within the colour table.
The image data for a table based image consists of a sequence of sub-blocks, of size at most 255 bytes each, containing an index into the active color table, for each pixel in the image. Pixel indices are in order of left to right and from top to bottom. Each index must be within the range of the size of the active color table, starting at 0. See http://www.w3.org/Graphics/GIF/spec-gif89a.txt section 22