---
title: "GifEncoderOptions Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_GifEncoderOptions.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# GifEncoderOptions Class
 
This class holds GIF encoder options.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```
Public NotInheritable Class GifEncoderOptions _Inherits EncoderOptions
```
 
```csharp
public sealed class GifEncoderOptions : EncoderOptions
```
 
## Remarks
  
This class enables to initialize both entire GIF file and separate frames settings. Usually you can use this class from [Saving](https://www.graphicsmill.com/docs/gm5/E_Aurigma_GraphicsMill_Bitmap_Saving.htm.md) event handler to modify both global and frames settings. If you set global settings for the same file multiple times, only settings specified at the first time are used.
 
This table gives the explanation for all GIF settings:
 
|  Property |  Description |
| --- | --- |
 |  [Delay](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_Delay.htm.md) (frame) |  Specifies a delay of the frame (how long should it be displayed). |
 |  [DisposalMethod](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_DisposalMethod.htm.md) (frame) |  Specifies a disposal method for the frame (what to do with the screen when new frame is being displayed). |
 |  [Interlaced](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_Interlaced.htm.md) (frame) |  Specifies whether the frame should be interlaced. |
 |  [BackgroundEntryIndex](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_BackgroundEntryIndex.htm.md) (global) |  Specifies an entry in the global palette which is treated as a background. |
 |  [GlobalPalette](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_GlobalPalette.htm.md) (global) |  Specifies a global palette for entire GIF file. |
 |  [LocalPaletteEnabled](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_LocalPaletteEnabled.htm.md) (global) |  Specifies whether to use local palettes for each frame or use global palette only. |
 |  [PlaybackCount](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_PlaybackCount.htm.md) (global) |  Specifies how much times the GIF should be animated (or if it should be played infinitely). |
 |  [Width](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_Width.htm.md) (global) |  Specifies a width of the GIF file. If dimensions of frame is larger of GIF dimensions, frame bitmap is cropped. |
 |  [Height](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_GifEncoderOptions_Height.htm.md) (global) |  Specifies a height of the GIF file. If dimensions of frame is larger of GIF dimensions, frame bitmap is cropped. |
 
[MediaFormat](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_EncoderOptions_MediaFormat.htm.md) property of this class always returns value that equals to [GifFormat](https://www.graphicsmill.com/docs/gm5/F_Aurigma_GraphicsMill_Codecs_FormatManager_GifFormat.htm.md) static field of the [FormatManager](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_FormatManager.htm.md) class. [Left](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_EncoderOptions_Left.htm.md) and [Top](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_EncoderOptions_Top.htm.md) are used to specify offset of the frame relatively top left corner of the GIF.
 
## Examples
  
Let's assume that we want to load a JPEG file and save this image as a web-optimized GIF file (for example, reduce number of colors to 32). This code sample demonstrates how to do it:
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg")

bitmap.ColorManagement.PaletteEntryCount = 32
bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, _
    Nothing)

bitmap.Save("C:\Mountain.gif", _
    New Aurigma.GraphicsMill.Codecs.GifEncoderOptions)

bitmap.Dispose()
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap(@"c:\Mountain.jpg"))
{
    bitmap.ColorManagement.PaletteEntryCount = 32;
    bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, 
        null);

    bitmap.Save(@"C:\Mountain.gif", 
        new Aurigma.GraphicsMill.Codecs.GifEncoderOptions());
}
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.Codecs.EncoderOptions](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_EncoderOptions.htm.md)
        - Aurigma.GraphicsMill.Codecs.GifEncoderOptions
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_153.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_GifEncoderOptions.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_151.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_ColorPalette.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill_ObjectModel_19.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_Frame.htm.md)
  
## See Also

### Reference

- [GifEncoderOptions Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Codecs_GifEncoderOptions.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
