This documentation is for the old version. Go to the latest Graphics Mill docs

GifFrame Class

This class represents a frame of the GIF format.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Public NotInheritable Class GifFrame _
	Inherits Frame
C#
public sealed class GifFrame : Frame

Examples

This code sample demonstrates how to create an animated GIF file from several JPEG files. Draw attention, you can use this code to save simple GIF files too (by passing the single frame into it).

Visual Basic
Dim dir As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\"
Dim images As String() = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"}
Dim image As String

Dim bitmap As New Aurigma.GraphicsMill.Bitmap

Dim writer As New Aurigma.GraphicsMill.Codecs.GifWriter("C:\Slideshow.gif")

For Each image In images
    bitmap.Load(dir & image)

    bitmap.ColorManagement.PaletteEntryCount = 32
    bitmap.ColorManagement.ConvertToIndexed(8, Aurigma.GraphicsMill.ColorPaletteType.Adaptive, _
        Nothing)

    Dim frame As New Aurigma.GraphicsMill.Codecs.GifFrame
    frame.Delay = 100
    frame.SetBitmap(bitmap)

    writer.AddFrame(frame)

    frame.Dispose()
Next

bitmap.Dispose()

writer.Dispose()
C#
string dir = @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures";
string[] images = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"};

using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap())
{
    using (Aurigma.GraphicsMill.Codecs.GifWriter writer = 
               new Aurigma.GraphicsMill.Codecs.GifWriter(@"C:\Slideshow.gif"))
    {
        foreach (string image in images)
        {
            bitmap.Load(dir + image);

            bitmap.ColorManagement.PaletteEntryCount = 32;
            bitmap.ColorManagement.ConvertToIndexed(8, 
                Aurigma.GraphicsMill.ColorPaletteType.Adaptive, null);
            
            using(Aurigma.GraphicsMill.Codecs.GifFrame frame = 
                      new Aurigma.GraphicsMill.Codecs.GifFrame())
            {
                frame.Delay = 100;
                frame.SetBitmap(bitmap);            
                writer.AddFrame(frame);
            }
        }
    }
}

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model




See Also

Reference