Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

jz5/APNG.NET

Open more actions menu
 
 

Repository files navigation

APNG.NET

A fully-managed APNG (Animated Portable Network Graphics) Parser

Original is https://github.com/xupefei/APNG.NET

Difference

  • LibAPNG is .NET Standard libary
  • Extensions for WPF (.NET Framework)
    • Convert each PNG frame to BitmapSource objects
    • Create key frame animation, So you can display APNG to Image control using Storyboard.
  • Remove XNA projects
  • Update to Visual Studio 2019

Usages

APNG to BitmapSource objects

var apng = new APNG("a.png");
var bitmaps = apng.ToBitmapSources();

// Save to PNG files
foreach (var (bitmap, index) in bitmaps.Select((item, index) => (item, index)))
{
    using (var fileStream = new FileStream($"{index}.png", FileMode.Create))
    {
        var encoder = new PngBitmapEncoder();
        encoder.Frames.Add(BitmapFrame.Create(bitmap));
        encoder.Save(fileStream);
    }
}

Display APNG to Image control

<Image Name="PngImage" />
var apng = new APNG("a.png");
if (apng.IsSimplePNG)
    PngImage.Source = BitmapFrame.Create(
        apng.DefaultImage.GetStream(), BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
else
    apng.ToAnimation().CreateStoryboardFor(PngImage).Begin(PngImage);

About

APNG (Animated PNG) for C#, WPF and .NET Standard

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.