gitmyhub

gifski

Rust ★ 5.6k updated 1mo ago

GIF encoder based on libimagequant (pngquant). Squeezes maximum possible quality from the awful GIF format.

A command-line tool and C library that converts video or PNG frames into high-quality animated GIFs using per-frame color optimization and dithering to maximize visual quality.

RustCWebAssemblyffmpegsetup: moderatecomplexity 2/5

Gifski is a tool for converting video into high-quality animated GIF files. GIF is an old image format that many sites and apps still use for short looping animations, but its main limitation is a 256-color palette per frame. Gifski gets around this by generating a separate optimized palette for each frame and using dithering (a technique that blends nearby pixels to simulate colors the palette cannot represent directly). The result is GIFs that appear to use thousands of colors rather than the standard 256.

The tool works from the command line. You feed it either a video file (using ffmpeg to pipe frames in) or a folder of PNG images exported from any video or animation software, and it produces a single animated GIF. If you are not comfortable with a terminal, GUI versions are available for Windows and macOS as separate downloads linked in the README.

File size is the main trade-off with GIF, and the README is direct about this: GIF compresses poorly no matter what settings you use. The main controls for reducing file size are reducing the width and height of the output and lowering the quality settings. The tool displays an estimated file size during compression, though it warns the estimate is imprecise. For very large inputs the tool will automatically shrink the output to keep sizes reasonable unless you override it.

Beyond the command-line tool, gifski can be compiled as a C library for use inside other applications. It also supports WebAssembly for use in browser-based tools and can be cross-compiled for iOS. The iOS version is used by at least one Mac and iOS app, which is linked in the README.

The project is written in Rust and licensed under AGPL 3, which requires any software that uses it to also be open source. Commercial licensing is available for products that cannot use the AGPL license.

Where it fits