A fully-managed APNG (Animated Portable Network Graphics) Parser
Original is https://github.com/xupefei/APNG.NET
- LibAPNG is .NET Standard libary
- Extensions for WPF (.NET Framework)
- Convert each PNG frame to
BitmapSourceobjects - Create key frame animation, So you can display APNG to
Imagecontrol usingStoryboard.
- Convert each PNG frame to
- Remove XNA projects
- Update to Visual Studio 2019
varapng=newAPNG("a.png");varbitmaps=apng.ToBitmapSources();// Save to PNG filesforeach(var(bitmap,index)inbitmaps.Select((item,index)=>(item,index))){using(varfileStream=newFileStream($"{index}.png",FileMode.Create)){varencoder=newPngBitmapEncoder();encoder.Frames.Add(BitmapFrame.Create(bitmap));encoder.Save(fileStream);}}<ImageName="PngImage" />varapng=newAPNG("a.png");if(apng.IsSimplePNG)PngImage.Source=BitmapFrame.Create(apng.DefaultImage.GetStream(),BitmapCreateOptions.None,BitmapCacheOption.OnLoad);elseapng.ToAnimation().CreateStoryboardFor(PngImage).Begin(PngImage);