SharpAstro.Gif 3.32.1561

This package has a SemVer 2.0.0 package version: 3.32.1561+25f80f8a848ba90b62c5922e98c826c7181bce96.
dotnet add package SharpAstro.Gif --version 3.32.1561
                    
NuGet\Install-Package SharpAstro.Gif -Version 3.32.1561
                    
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="SharpAstro.Gif" Version="3.32.1561" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpAstro.Gif" Version="3.32.1561" />
                    
Directory.Packages.props
<PackageReference Include="SharpAstro.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 SharpAstro.Gif --version 3.32.1561
                    
#r "nuget: SharpAstro.Gif, 3.32.1561"
                    
#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 SharpAstro.Gif@3.32.1561
                    
#: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=SharpAstro.Gif&version=3.32.1561
                    
Install as a Cake Addin
#tool nuget:?package=SharpAstro.Gif&version=3.32.1561
                    
Install as a Cake Tool

SharpAstro.Gif

Pure-managed GIF decoding for .NET 10, written from the GIF89a specification (GIF87a is its subset). There is no encoder, by design.

GifDecoder.Decode gives a still: the first frame, composited onto the logical screen, as non-premultiplied RGBA8. GifDecoder.DecodeAnimation and GifAnimationDecoder give every frame, each as the whole logical screen after the frame was drawn, with the Graphic Control Extension's disposal applied. Global and local palettes, interlaced images and the transparent colour index are applied. The raw delay (1/100 s, 0 stays 0), disposal method, the NETSCAPE2.0 / ANIMEXTS1.0 loop count and every frame's rectangle are reported. Unknown extensions are skipped by their sub-block lengths. The SharpAstro.Codecs facade sniffs GIF87a / GIF89a and returns the first frame.

using SharpAstro.Gif;

byte[] data = File.ReadAllBytes("image.gif");

// One still.
GifImage image = GifDecoder.Decode(data);
Console.WriteLine($"{image.Width} × {image.Height}, {image.Info.FrameCount} frame(s)");

// Every frame as its own canvas (refused above 2^28 pixels in all, before anything is allocated).
GifAnimation animation = GifDecoder.DecodeAnimation(data);
foreach (GifAnimationFrame frame in animation.Frames)
{
    Console.WriteLine($"frame {frame.Index}: {frame.DelayCentiseconds} cs, disposal {frame.DisposalMethod}");
}

// Or through one canvas, however many frames: Current.Rgba is that canvas, valid until the next MoveNext.
var stream = new GifAnimationDecoder(data);
while (stream.MoveNext())
{
    Show(stream.Current.Rgba, stream.Current.DelayCentiseconds);
}

Compositing follows GIF89a where it is specific and Magick.NET's Coalesce() where it is not (and the tests compare every frame with it): disposal 0, 1 and the reserved 4-7 leave the canvas, 2 clears the frame's rectangle to alpha 0 (the RGB stays), 3 puts back what the rectangle held before. A frame is disposed before the next is drawn and the last one's disposal never applies. The canvas before frame 0 is the global table's colour at the background index (alpha 0 when frame 0 has a transparent index, white without a global table).

Incomplete files decode what is there and say so rather than failing: a truncated LZW stream sets IsTruncated (the unreached pixels keep the canvas as it was), and a missing trailer or bytes after it show in GifInfo.HasTrailer / GifInfo.UnparsedByteCount. What is refused, before any raster is allocated: a logical screen above 67,108,864 pixels, a frame rectangle that is empty or does not lie inside the screen, an LZW minimum code size outside 2-8, and an animation whose screen × frame count is above the limit. A frame with no colour table at all reads as an all-black palette, and an index past the end of its table as opaque black.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on SharpAstro.Gif:

Package Downloads
SharpAstro.Codecs

Image-codec facade over the SharpAstro codec family: sniff a byte stream's format by its magic-byte signature and dispatch to the matching decoder (PNG, JPEG, TIFF, JPEG XR, OpenEXR, JPEG XL, JBIG2, JPEG 2000, WebP, GIF, Radiance RGBE, Netpbm PBM/PGM/PPM/PAM, BMP, and TGA by its TGA 2.0 footer, since a TGA has no leading magic number), returning a codec-neutral IDecodedImage (fidelity tier: native bit depth + ColorEncoding colour signalling, with a ToFloats() RGBA float32 view) or decoding zero-copy into a caller-provided 8-bit RGBA buffer (display tier, integer-sample formats). AOT-compatible.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.32.1561 29 11/3/2026
3.32.1541 27 11/3/2026
3.31.1511 25 11/3/2026