Class GIFFile
Represents the binary view of a GIF file.
Inherited Members
Namespace: ExifLibrary
Assembly: ExifLibrary.dll
Syntax
public class GIFFile : ImageFile
Constructors
| Improve this Doc View SourceGIFFile(MemoryStream, Encoding)
Initializes a new instance of the GIFFile class from the specified data stream.
Declaration
protected GIFFile(MemoryStream stream, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
System.Text.Encoding | encoding | The encoding to be used for text metadata when the source encoding is unknown. |
Properties
| Improve this Doc View SourceBackcolorIndex
Gets the index of the backcolor in the global color table.
Declaration
public byte BackcolorIndex { get; }
Property Value
Type | Description |
---|---|
System.Byte |
Blocks
Gets the blocks contained in the GIFFile.
Declaration
public List<GIFBlock> Blocks { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<GIFBlock> |
ColorResolution
Gets the bumber of bits per primary color available.
Declaration
public byte ColorResolution { get; }
Property Value
Type | Description |
---|---|
System.Byte |
GCT
Gets the global color table.
Declaration
public byte[, ] GCT { get; }
Property Value
Type | Description |
---|---|
System.Byte[,] |
HasGCT
Gets whether the file contains a global color table.
Declaration
public bool HasGCT { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsGCTSorted
Gets whether the global color table is sorted.
Declaration
public bool IsGCTSorted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
PixelAspectRatio
Gets the pixel aspect ratio. The actual aspect ratio is calculated as: Aspect Ratio = (Pixel Aspect Ratio + 15) / 64.
Declaration
public byte PixelAspectRatio { get; }
Property Value
Type | Description |
---|---|
System.Byte |
ScreenHeight
Gets the raster height in pixels.
Declaration
public ushort ScreenHeight { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
ScreenWidth
Gets the raster width in pixels.
Declaration
public ushort ScreenWidth { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
SizeOfGCT
Gets the size of the global color table.
Declaration
public byte SizeOfGCT { get; }
Property Value
Type | Description |
---|---|
System.Byte |
Version
Gets the GIF version string. e.g. 89a
Declaration
public string Version { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceCrush()
Decreases file size by removing all ancillary chunks.
Declaration
public override void Crush()
Overrides
| Improve this Doc View SourceReadColorTable(MemoryStream, Int32)
Reads a GIF color table.
Declaration
protected byte[, ] ReadColorTable(MemoryStream stream, int length)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
System.Int32 | length | Length of color table. |
Returns
Type | Description |
---|---|
System.Byte[,] |
ReadDataBlock(MemoryStream)
Reads data sub-blocks.
Declaration
protected byte[][] ReadDataBlock(MemoryStream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
Returns
Type | Description |
---|---|
System.Byte[][] |
ReadMetadata()
Reads GIF metadata in extension blocks.
Declaration
protected void ReadMetadata()
SaveInternal(MemoryStream)
Saves the ImageFile to the given stream.
Declaration
protected override void SaveInternal(MemoryStream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | The data stream used to save the image. |
Overrides
| Improve this Doc View SourceWriteColorTable(MemoryStream, Byte[,])
Writes GIF color table.
Declaration
protected void WriteColorTable(MemoryStream stream, byte[, ] table)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
System.Byte[,] | table | Color table. |
WriteDataBlock(MemoryStream, Byte[][])
Writes data sub-blocks.
Declaration
protected void WriteDataBlock(MemoryStream stream, byte[][] data)
Parameters
Type | Name | Description |
---|---|---|
System.IO.MemoryStream | stream | A stream that contains image data. |
System.Byte[][] | data | A data sub-block |
WriteMetadata()
Writes GIF metadata into extension blocks.
Declaration
protected void WriteMetadata()