Table of Contents

Class GifOptions

Namespace
Aspose.Imaging.ImageOptions
Assembly
Aspose.Imaging.dll

The API for Graphical Interchange Format (GIF) raster image file creation offers developers comprehensive options for generating GIF images with precise control. With features to set background color, color palette, resolution, interlaced type, transparent color, XMP metadata container, and image compression, this API ensures flexibility and efficiency in creating optimized and visually appealing GIFs tailored to specific application requirements.

public class GifOptions : ImageOptionsBase, IDisposable, IHasXmpData, IHasMetadata
Inheritance
GifOptions
Implements
Inherited Members

Constructors

GifOptions()

Initializes a new instance of the GifOptions class.

public GifOptions()

GifOptions(GifOptions)

Initializes a new instance of the GifOptions class.

public GifOptions(GifOptions gifOptions)

Parameters

gifOptions GifOptions

The GIF Options.

Properties

BackgroundColor

Gets or sets the background color.

public Color BackgroundColor { get; set; }

Property Value

Color

BackgroundColorIndex

Gets or sets the GIF background color index.

public byte BackgroundColorIndex { get; set; }

Property Value

byte

The GIF background color index.

ColorResolution

Gets or sets the GIF color resolution.

public byte ColorResolution { get; set; }

Property Value

byte

The color resolution.

Remarks

Color Resolution - Number of bits per primary color available to the original image, minus 1. This value represents the size of the entire palette from which the colors in the graphic were selected, not the number of colors actually used in the graphic. For example, if the value in this field is 3, then the palette of the original image had 4 bits per primary color available to create the image. This value should be set to indicate the richness of the original palette, even if not every color from the whole palette is available on the source machine.

DoPaletteCorrection

Gets or sets a value indicating whether palette correction is applied.

public bool DoPaletteCorrection { get; set; }

Property Value

bool

true if palette correction is applied; otherwise, false.

Remarks

Palette correction means that whenever image is exported to GIF the source image colors will be analyzed in order to build the best matching palette (in case image Palette does not exist or not specified in the options). The analyze process takes some time however the output image will have the best matching color palette and result is visually better.

HasTrailer

Gets or sets a value indicating whether GIF has trailer.

public bool HasTrailer { get; set; }

Property Value

bool

true if GIF has trailer; otherwise, false.

HasTransparentColor

Gets or sets a value indicating whether GIF image has transparent color.

public bool HasTransparentColor { get; set; }

Property Value

bool

Interlaced

True if image should be interlaced.

public bool Interlaced { get; set; }

Property Value

bool

IsPaletteSorted

Gets or sets a value indicating whether palette entries are sorted.

public bool IsPaletteSorted { get; set; }

Property Value

bool

true if palette entries are sorted; otherwise, false.

LoopsCount

Gets or sets the loops count (Default 1 loop)

public int LoopsCount { get; set; }

Property Value

int

The loops count.

MaxDiff

Gets or sets the maximum allowed pixel difference. If greater than zero, lossy compression will be used. Recommended value for optimal lossy compression is 80. 30 is very light compression, 200 is heavy. It works best when only little loss is introduced, and due to limitation of the compression algorithm very high loss levels won't give as much gain. The range of allowed values is [0, 1000].

public int MaxDiff { get; set; }

Property Value

int

PixelAspectRatio

Gets or sets the GIF pixel aspect ratio.

public byte PixelAspectRatio { get; set; }

Property Value

byte

The GIF pixel aspect ratio.

Remarks

Pixel Aspect Ratio - Factor used to compute an approximation of the aspect ratio of the pixel in the original image. If the value of the field is not 0, this approximation of the aspect ratio is computed based on the formula: Aspect Ratio = (Pixel Aspect Ratio + 15) / 64 The Pixel Aspect Ratio is defined to be the quotient of the pixel's width over its height. The value range in this field allows specification of the widest pixel of 4:1 to the tallest pixel of 1:4 in increments of 1/64th. Values : 0 - No aspect ratio information is given. 1..255 - Value used in the computation.