gifski

Highest-quality GIF encoder based on pngquant, squeezing thousands of colors per frame from video and PNG sequences.

Tool
Cargo
v1.34.0
5,600stars
AGPL-3.0-or-later

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
59/100Fair
Development Activity36
Maintenance44
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
83/100Excellent
Architecture85
Code Quality82
Innovation88
Learning Curve78

gifski is a command-line GIF encoder built on pngquant’s libimagequant that turns video frames or PNG sequences into high-quality animated GIFs. It uses efficient cross-frame palettes and temporal dithering to produce animations that use thousands of colors per frame, far beyond what a naive GIF encoder achieves.

Although it is primarily a CLI tool, gifski can also be compiled as a C library or for WebAssembly, making its encoder reusable inside other applications and GUIs. It accepts input from ffmpeg pipes or directories of PNG frames and exposes quality, size, and motion controls to trade file size against fidelity.

What You Get

  • A CLI that converts video streams or PNG frame sequences into optimized animated GIFs
  • pngquant-based cross-frame palettes and temporal dithering for thousands of colors per frame
  • Quality, lossy-quality, motion-quality, width, and height flags to balance size against fidelity
  • A C API (gifski.h) and cdylib/staticlib builds for embedding the encoder in other apps
  • Optional WebAssembly and iOS builds, plus optional direct video decoding via ffmpeg

Common Use Cases

  • Converting an ffmpeg-decoded video into a high-quality GIF from the terminal
  • Turning a directory of rendered PNG frames into an animated GIF
  • Embedding the gifski encoder as a C library inside a desktop GUI app
  • Producing size-constrained GIFs by tuning quality and dimension flags

Under The Hood

Architecture - gifski is written mostly in Rust (~93%) with a small C component (~7%). At its core it wraps pngquant’s libimagequant to compute per-frame palettes, then applies temporal dithering across frames to reuse colors efficiently within GIF’s 256-color-per-frame constraint. Input comes either from a yuv4mpegpipe stream (typically produced by ffmpeg) or a list of PNG files, and frames are optionally downscaled before quantization. A collector/writer pipeline feeds quantized frames into the GIF encoder while reporting an estimated running file size.

Tech Stack - The project targets up-to-date stable Rust (1.63+) and builds via Cargo. It exposes a C API through gifski.h and uses cargo-c to produce a proper cdylib plus pkg-config file; wasm-pack targets WebAssembly and cargo-xcode/rustup targets iOS. Optional direct video decoding depends on ffmpeg 6.x and libclang behind a video feature.

Code Quality - The codebase is mature after 500+ commits and 34 releases since 2017, maintained primarily by the pngquant author. It is production-grade and widely used (600k+ crate downloads), though it leans on manual and integration testing around the encoder rather than an extensive unit-test suite.

API Design - As a CLI the interface is approachable: a single command with intuitive flags (—quality, —width, —lossy-quality, —motion-quality) and helpful drag-and-drop guidance in the README. The companion C API is small and documented on docs.rs, making embedding straightforward for GUI wrappers like the macOS and Windows apps built on it.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search