[]
Allows reading images from a multi-page GIF file/stream.
public class GcGifReader : IDisposable
Initializes a new instance of GcGifReader class and assigns the input stream.
public GcGifReader(Stream stream, bool ownStream = false, int frameIndex = -1)
stream
System.IO.StreamThe input stream.
ownStream
boolIndicates if the input stream should be closed when the GcGifReader is disposed.
frameIndex
intIndex of a frame to read. Pass -1 to get all frames.
Initializes a new instance of GcGifReader class and assigns the input file.
public GcGifReader(string filePath, int frameIndex = -1)
filePath
stringFull path to the input .gif file.
frameIndex
intIndex of a frame to read. Pass -1 to get all frames.
Gets the number of Comment Extensions in the source GIF file.
public int CommentCount { get; }
Gets the horizontal DPI of the Logical Screen.
public float DpiX { get; }
Gets the vertical DPI of the Logical Screen.
public float DpiY { get; }
If possible, gets full path to the associated .gif file.
public string FilePath { get; }
Gets the list of frames in the associated GIF file.
public IReadOnlyList<GifFrame> Frames { get; }
Gets a value indicating if there is the Global Color Table in the GIF file.
public bool HasGlobalPalette { get; }
Gets or sets the raw ICC profile data for the frames.
public byte[] IccProfileData { get; set; }
Gets a value indicating whether the GcGifReader has been disposed of.
public bool IsDisposed { get; }
Gets the height, in pixels, of the Logical Screen where the frames will be rendered.
public int LogicalScreenHeight { get; }
Gets the width, in pixels, of the Logical Screen where the frames will be rendered.
public int LogicalScreenWidth { get; }
Gets the number of iterations the animated GIF should be executed. 0 means infinite loop.
public int LoopCount { get; }
Gets a value indicating if the associated stream should be closed when the GcGifReader is disposed.
public bool OwnStream { get; }
Gets the quotient of the pixel's width over its height.
public float PixelAspectRatio { get; }
Gets the Stream associated with GcGifReader.
public Stream Stream { get; }
Gets the start position in the associated Stream.
public long StreamStartPosition { get; }
Applies a license key to an instance of GcGifReader.
public void ApplyLicenseKey(string key)
key
stringThe license key to set.
Clean up any resources being used.
public void Dispose()
Performs cleanup operations on managed and unmanaged resources.
protected virtual void Dispose(bool disposing)
disposing
boolPerforms cleanup operations on unmanaged resources.
protected ~GcGifReader()
If the Comment Extension is present in the source GIF file this method decodes the comment using the specified Encoding and returns it as a string.
public string GetComment(Encoding textEncoding, int commentIndex = 0)
textEncoding
System.Text.EncodingCharacter encoding, such as Encoding.ASCII.
commentIndex
intIndex of the Comment Extension, from 0 to CommentCount - 1.
Comment as a string or null if the source GIF file contains no Comment Extension with given index.
If the Comment Extension is present in the source GIF file this method returns the comment data as is, without decoding.
public byte[] GetCommentData(int commentIndex = 0)
commentIndex
intIndex of the Comment Extension, from 0 to CommentCount - 1.
Comment as a byte array or null if the source GIF file contains no Comment Extension with given index.
Returns a palette with sorted opaque colors in 32-bit ARGB format retrieved from the Global Color Table.
public uint[] GetGlobalPalette()