Openize.Animated-GIF 25.5.0

dotnet add package Openize.Animated-GIF --version 25.5.0
                    
NuGet\Install-Package Openize.Animated-GIF -Version 25.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Openize.Animated-GIF" Version="25.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Openize.Animated-GIF" Version="25.5.0" />
                    
Directory.Packages.props
<PackageReference Include="Openize.Animated-GIF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Openize.Animated-GIF --version 25.5.0
                    
#r "nuget: Openize.Animated-GIF, 25.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Openize.Animated-GIF&version=25.5.0
                    
Install Openize.Animated-GIF as a Cake Addin
#tool nuget:?package=Openize.Animated-GIF&version=25.5.0
                    
Install Openize.Animated-GIF as a Cake Tool

Openize.Animated-GIF for .NET

A .NET library for creating and reading animated GIF files. This is a C# port of the popular animated-gif-lib-for-java library, providing robust support for GIF encoding and decoding with advanced features like color quantization, transparency control, and frame management.

Features

  • Animated GIF Encoding: Create animated GIFs from any sequence of images
  • GIF Decoding: Extract frames and metadata from existing GIF files
  • Advanced Color Quantization: Uses NeuQuant algorithm for optimal color reduction
  • Transparency Support: Full control over transparent colors
  • Animation Control: Set frame delays, loop counts, and disposal methods
  • Background Management: Specify background colors and handle oversized images

Installation

dotnet add package Openize.Animated.GIF

Or via NuGet Package Manager:

Install-Package Openize.Animated.GIF

Quick Start

Creating an Animated GIF

using Openize.Animated.GIF;
using System.Drawing;

// Initialize the encoder
var encoder = new AnimatedGifEncoder();
encoder.Start("output.gif");

// Configure animation settings
encoder.SetDelay(500);    // 500ms between frames
encoder.SetRepeat(0);     // Loop infinitely

// Add frames
encoder.AddFrame(new Bitmap("frame1.png"));
encoder.AddFrame(new Bitmap("frame2.png"));

// Finish encoding
encoder.Finish();

Reading an Animated GIF

// Initialize the decoder
var decoder = new GifDecoder();
decoder.Read("input.gif");

// Get information
int frameCount = decoder.GetFrameCount();
int loopCount = decoder.GetLoopCount();  // 0 = infinite

// Extract frames
for (int i = 0; i < frameCount; i++)
{
    Bitmap frame = decoder.GetFrame(i);
    frame.Save($"frame_{i}.png");
}

Advanced Options

// Configure transparency
encoder.SetTransparent(Color.White, true);  // Exact match

// Set specific background color
encoder.SetBackground(Color.Black);

// Custom size (for oversized images)
encoder.SetSize(800, 600);

Requirements

  • .NET 6.0 or later
  • System.Drawing.Common (automatically installed)

Platform Compatibility

This library uses System.Drawing.Common which has some limitations on non-Windows platforms. For production use on Linux or macOS, you may need to install additional dependencies:

  • Linux: apt-get install libgdiplus
  • macOS: brew install mono-libgdiplus

License

Openize.Animated-GIF for .NET is licensed under the Apache License 2.0.

Openize does not and cannot grant You a patent license for the utilization of animated-gif-lib-for-java compression/decompression technologies.

Contributing

Feel free to submit issues and enhancement requests!

Acknowledgments

This library is a C# port of animated-gif-lib-for-java by Roberto Tyley, ported and maintained by Openize Pty Ltd.

OSS Notice

Sample files used for tests and located in the "./testdata/" folder belong to animated-gif-lib-for-java and are used according to Apache License 2.0.


For more information and documentation, visit Openize.com.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
25.5.0 0 5/6/2025