AnimatedPngCreator.SkiaSharp 2.0.3

dotnet add package AnimatedPngCreator.SkiaSharp --version 2.0.3
                    
NuGet\Install-Package AnimatedPngCreator.SkiaSharp -Version 2.0.3
                    
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="AnimatedPngCreator.SkiaSharp" Version="2.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnimatedPngCreator.SkiaSharp" Version="2.0.3" />
                    
Directory.Packages.props
<PackageReference Include="AnimatedPngCreator.SkiaSharp" />
                    
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 AnimatedPngCreator.SkiaSharp --version 2.0.3
                    
#r "nuget: AnimatedPngCreator.SkiaSharp, 2.0.3"
                    
#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.
#:package AnimatedPngCreator.SkiaSharp@2.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AnimatedPngCreator.SkiaSharp&version=2.0.3
                    
Install as a Cake Addin
#tool nuget:?package=AnimatedPngCreator.SkiaSharp&version=2.0.3
                    
Install as a Cake Tool

AnimatedPngCreator

Creates animated PNG out ouf a sequence of Images.

Please use the newest version on NuGet. <br> Get the package on NuGet

Dispose the creator to end the creating process. On disposing the count of images will be written to the header.

24.08.2025 v2.0.0 New project stucture: AnimatedPngCreator and AnimatedPngCreator.System.Drawing or AnimatedPngCreator.SkiaSharp is needed <br> 12.10.2018 Bug fixed, tests added, new static methods added - v1.0.3 merged to master <br> 29.8.2018 Bug fixed, test added, v1.0.2 deployed on NuGet <br> 27.8.2018 Filter added to detect unchanged pixels, console app added, v1.0.1 deployed on NuGet

V1.0.3 makes it possible to use the static Create method.

The third parameter is the time to show the frame, in milli seconds.

Breaking Changes:

v2.0.0 Use BitmapFactory.FromFile instead of Image.FromFile and install AnimatedPngCreator.System.Drawing or AnimatedPngCreator.SkiaSharp

// Example 1:
var filePaths = new List<string>
{
    "1.bmp", "2.bmp", "3.bmp"
};
CMK.AnimatedPngCreator.Create("out.png", filePaths, 1000);

// Example 2:
var images = new List<Image>
{
    BitmapFactory.FromFile("1.bmp"),
    BitmapFactory.FromFile("2.bmp"),
    BitmapFactory.FromFile("3.bmp")
};
CMK.AnimatedPngCreator.Create("out.png", images, 1000);

// Example 3:
var frames = new List<Frame>
{
    CMK.AnimatedPngCreator.Frame(BitmapFactory.FromFile("1.bmp"), 1000),
    CMK.AnimatedPngCreator.Frame(BitmapFactory.FromFile("2.bmp"), 1000),
    CMK.AnimatedPngCreator.Frame(BitmapFactory.FromFile("3.bmp"), 1000)
};
CMK.AnimatedPngCreator.Create("out.png", frames);

The filter to remove unchanged pixels is on by default. If you don't want to use the filter, you just have to pass a config to the constructor:

var config = new AnimatedPngCreator.Config
{
    FilterUnchangedPixels = false
};
using (var apngCreator = new AnimatedPngCreator(outputFile, image1.Width, image1.Height, config))

Example 1:

// Add three images to an APNG
using CMK;
using System.Drawing;
using System.IO;

namespace ApngTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Image image1 = BitmapFactory.FromFile("filename1.bmp");
            Image image2 = BitmapFactory.FromFile("filename2.jpg");
            Image image3 = BitmapFactory.FromFile("filename3.png");

            short frameDelay = 1000 / 5; //5 frames per second
            using (FileStream outputFile = File.Create("animated.png"))
            {
                using (var apngCreator = new AnimatedPngCreator(outputFile, image1.Width, image1.Height))
                {
                    apngCreator.WriteFrame(image1, frameDelay);
                    apngCreator.WriteFrame(image2, frameDelay);
                    apngCreator.WriteFrame(image3, frameDelay);
                }
            }
        }
    }
}

Example 2:

using CMK;
using System.Collections.Generic;
using System.Drawing;
using System.IO;

namespace ApngTest
{
    class Program
    {
        static void Main(string[] args)
        {
            List<Image> images = new List<Image>
            {
                BitmapFactory.FromFile("filename1.bmp"),
                BitmapFactory.FromFile("filename2.jpg"),
                BitmapFactory.FromFile("filename3.png")
            };

            short frameDelay = 1000 / 5; //5 frames per second
            using (FileStream outputFile = File.Create("animated.png"))
            {
                using (var apngCreator = new AnimatedPngCreator(outputFile, images[0].Width, images[0].Height))
                {
                    foreach(var image in images)
                    {
                        apngCreator.WriteFrame(image, frameDelay);
                    }
                }
            }
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.3 15 8/24/2025
2.0.1 16 8/24/2025

Version 2.0.3 – Release Notes

     New Modular Structure

     The package has been restructured into a modular format.

     The core functionality is now separated from the platform-specific wrappers.

     Users can choose which wrapper to include (e.g., System.Drawing or Skia) depending on their environment.

     Existing projects can adopt the new structure with minimal changes.