GifDecoder Class |
An ImageDecoder used to read Compuserve Graphics Interchange (GIF) images from a Stream.
Namespace: Atalasoft.Imaging.Codec
The GifDecoder type exposes the following members.
Name | Description | |
---|---|---|
GifDecoder | Initializes a new instance of a %GifDecoder%. |
Name | Description | |
---|---|---|
Frames | Gets a GifFrameCollection from an animated GIF. | |
SupportedImageType | Obsolete. Returns a Gif ImageType enumeration value. (Overrides ImageDecoderSupportedImageType.) |
Name | Description | |
---|---|---|
Dispose |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
| |
Dispose(Boolean) |
Releases unmanaged and - optionally - managed resources.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize |
Finalizes an instance of the GifDecoder class.
(Overrides ObjectFinalize.) | |
GetFrameCount | Gets the number of frames in a GIF. | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetImageInfo(Stream) | Retreive information from a Gif image stored in a Stream without decoding the image data. (Overrides ImageDecoderGetImageInfo(Stream).) | |
GetImageInfo(Stream, Int32) | Retreive information from a specified frame in a Gif image stored in a Stream without decoding the image
data. (Overrides MultiFramedImageDecoderGetImageInfo(Stream, Int32).) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsValidFormat | Returns true if the specified Stream contains a Gif image. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Read(Stream, ProgressEventHandler) | Returns an %AtalaImage% from a Stream containing a Gif encoded image. (Overrides ImageDecoderRead(Stream, ProgressEventHandler).) | |
Read(Stream, Int32, ProgressEventHandler) | Returns a specified frame to an %AtalaImage% from a Stream containing an animated Gif encoded image.
(Overrides MultiFramedImageDecoderRead(Stream, Int32, ProgressEventHandler).) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
By default, when opening a Gif image using the AtalaImage or Workspace objects, this decoder will automatically be selected from the RegisteredDecoders and does not have to be explicitly set.
// Open the file for reading. FileStream fs = new FileStream(this.fileName, FileMode.Open, FileAccess.Read); // Make sure it's a valid GIF. GifDecoder gif = new GifDecoder(); if (gif.IsValidFormat(fs) == false) { fs.Close(); return; } // Seek back to the beginning of the file. fs.Seek(0, SeekOrigin.Begin); // The first time you access the GetFrameCount property, // all of the frames are read into memory and are waiting // for you to access them. int count = gif.GetFrameCount(fs); // Use the GifFrame properties to reconstruct the animation. GifFrameCollection col = gif.Frames; // Close the file. fs.Close();
' Open the file for reading. Dim fs As FileStream = New FileStream(Me.fileName,FileMode.Open,FileAccess.Read) ' Make sure it's a valid GIF. Dim gif As GifDecoder = New GifDecoder() If gif.IsValidFormat(fs) = False Then fs.Close() Return End If ' Seek back to the beginning of the file. fs.Seek(0, SeekOrigin.Begin) ' The first time you access the GetFrameCount property, ' all of the frames are read into memory and are waiting ' for you to access them. Dim count As Integer = gif.GetFrameCount(fs) ' Use the GifFrame properties to reconstruct the animation. Dim col As GifFrameCollection = gif.Frames ' Close the file. fs.Close()