SharpApng.Cli
0.3.0
dotnet tool install --global SharpApng.Cli --version 0.3.0
dotnet new tool-manifest
dotnet tool install --local SharpApng.Cli --version 0.3.0
#tool dotnet:?package=SharpApng.Cli&version=0.3.0
nuke :add-package SharpApng.Cli --version 0.3.0
sharpapng
Command line tool for building and inspecting animated PNGs.
dotnet tool install --global SharpApng.Cli
sharpapng create -o walk.png -d 80 frame*.png # build an animation
sharpapng convert logo.gif # GIF, JPEG or BMP to PNG
sharpapng resize photo.jpg -s 256 # thumbnail, aspect preserved
sharpapng info walk.png # frame list, delays, offsets
sharpapng extract walk.png ./frames # split back into still PNGs
create
sharpapng create --output <file> [options] <image>...
-o, --output <file> Where to write the APNG. Required.
-p, --poster <file> A still shown only by viewers without APNG support,
kept out of the animation. Must match the canvas.
-d, --delay <ms> Milliseconds per frame. Default 100.
-l, --loop <n> Play count; 0 loops forever. Default 0.
--16-bit Store 16 bits per channel instead of 8.
--no-optimize Store every frame whole instead of just what changed.
--fast Compress quickly rather than tightly.
--smallest Compress as tightly as zlib allows.
--zopfli Compress with Zopfli instead of zlib.
--zopfli-iterations <n>
Zopfli passes per image; implies --zopfli. Default 15.
Inputs may be PNG, JPEG, GIF (its first frame) or BMP, and every frame must match the first one's dimensions. By default only the rectangle that changed between frames is stored, which on typical content is a large saving: a 320×320, 24-frame animation with a small moving sprite came out 91.9 % smaller than storing whole frames.
Smaller files with Zopfli
--zopfli works with every command that writes — create, convert, resize and extract —
and compresses with Zopfli instead of zlib. The files are typically 6–9 % smaller than with
--smallest, with exactly the same pixels, and any PNG decoder reads them. The price is time:
from a second or two for one image to minutes for a long animation. A 47-frame, 300×250 animation
took 94 s instead of 1.4 s, a 12-frame one 13 s instead of 0.7 s. Worth it for assets compressed
once and served often.
extract writes composited frames — what a viewer displays — not the cropped sub-images the
file stores internally. When the file carries a separate poster, it comes out as poster.png,
and create --poster puts it back.
Checking a deployed file
CDN optimisers, CMS thumbnail steps and build tasks such as imagemin or pngquant re-encode
PNGs and silently discard the chunks that carry the animation. The result is a valid PNG that no
longer moves, with no error anywhere to announce it. info reports it directly:
$ sharpapng info deployed.png
Container : PNG
Animated : no
Frames : 1
This PNG carries no acTL chunk, so it is a still image. ...
Standalone binaries
If you would rather not install a .NET runtime, each release also ships a single self-contained executable for Windows x64/x86/ARM64, Linux x64/ARM64/ARM and macOS on both architectures.
Built on SharpApng, a dependency-free APNG library.
--zopfli uses ZopfliSharp, which the tool
includes under the Apache License 2.0; its licence and NOTICE are in THIRD-PARTY-NOTICES.md,
shipped in this package and in every release archive.
Source and documentation · MIT, ZopfliSharp Apache-2.0
| Product | Versions 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. |
This package has no dependencies.
Adds --zopfli and --zopfli-iterations to create, convert, resize and extract: files typically 6-9 % smaller than with --smallest, at a steep cost in time. Includes ZopfliSharp (Apache-2.0); see THIRD-PARTY-NOTICES.md. extract now rejects unexpected arguments. The standalone binaries add Windows x86 and ARM64, and build 32-bit ARM Linux with NativeAOT.