
gifski
CLI基于 pngquant 的高质量 GIF 编码器:把视频帧或 PNG 序列转成动图,跨帧调色板与时间抖动让每帧可用数千种颜色;可通过管道直接接收 ffmpeg 输出的视频。
Highest-quality GIF encoder based on pngquant.
gifski converts video frames to GIF animations using pngquant's fancy features for efficient cross-frame palettes and temporal dithering. It produces animated GIFs that use thousands of colors per frame.

It's a CLI tool, but it can also be compiled as a C library for seamless use in other apps.
Download and install
See releases page for executables.
If you have Homebrew, you can also get it with brew install gifski.
If you have Rust from rustup (1.63+), you can also build it from source with cargo install gifski.
Usage
gifski is a command-line tool. If you're not comfortable with a terminal, try the GUI version for Windows or for macOS.
From ffmpeg video
Tip: Instead of typing file paths, you can drag'n'drop files into the terminal window!
If you have ffmpeg installed, you can use it to stream a video directly to the gifski command by adding -f yuv4mpegpipe to ffmpeg's arguments:
ffmpeg -i video.mp4 -f yuv4mpegpipe - | gifski -o anim.gif -
Replace "video.mp4" in the above code with actual path to your video.
Note that there's - at the end of the command. This tells gifski to read from standard input. Reading a .y4m file from disk would work too, but these files are huge.
gifski may automatically downsize the video if it has resolution too high for a GIF. Use --width=1280 if you can tolerate getting huge file sizes.
From PNG frames
A directory full of PNG frames can be used as an input too. You can export them from any animation software. If you have ffmpeg installed, you can also export frames with it:
ffmpeg -i video.webm frame%04d.png
and then make the GIF from the frames:
gifski -o anim.gif frame*.png
Note that * is a special wildcard character, and it won't work when placed inside quoted string ("*").
You can also resize frames (with -W <width in pixels> option). If the input was ever encoded using a lossy video codec it's recommended to at least halve size of the frames to hide compression artefacts and counter chroma subsampling that was done by the video codec.
See gifski --help for more options.
Tips for smaller GIF files
Expect to lose a lot of quality for little gain. GIF just isn't that good at compressing, no matter how much you compromise.
- Use
--widthand--heightto make the animation smaller. This makes the biggest difference. - Add
--quality=80(or a lower number) to lower overall quality. You can fine-tune the quality with:--lossy-quality=60lower values make animations noisier/grainy, but reduce file sizes.--motion-quality=60lower values cause smearing or banding in frames with motion, but reduce file sizes.
If you need to make a GIF that fits a predefined file size, you have to experiment with different sizes and quality settings. The command line tool will display estimated total file size during compression, but keep in mind that the estimate is very imprecise.
Building
- Install Rust via rustup. This project only supports up-to-date versions of Rust. You may get errors about "unstable" features if your compiler version is too old. Run
rustup update. - Clone the repository:
git clone https://github.com/ImageOptim/gifski - In the cloned directory, run:
cargo build --release. This will build in./target/release.
Using from C
See gifski.h for the C API. To build the library, run:
rustup update
cargo build --release
and link with target/release/libgifski.a. Please observe the LICENSE.
C dynamic library for package maintainers
The build process uses cargo-c for building the dynamic library correctly and generating the pkg-config file.
rustup update
cargo install cargo-c
# build
cargo cbuild --prefix=/usr --release
# install
cargo cinstall --prefix=/usr --release --destdir=pkgroot
The cbuild command can be omitted, since cinstall will trigger a build if it hasn't been done already.
For WASM
To build the library for WebAssembly, you need to have wasm-pack installed. Then run:
wasm-pack build --target web --features wasm --no-default-features
License
AGPL 3 or later. I can offer alternative licensing options, including commercial licenses. Let me know if you'd like to use it in a product incompatible with this license.
With built-in video support
The tool optionally supports decoding video directly, but unfortunately it relies on ffmpeg 6.x, which may be very hard to get working, so it's not enabled by default.
You must have ffmpeg and libclang installed, both with their C headers installed in default system include paths. Details depend on the platform and version, but you usually need to install packages such as libavformat-dev, libavfilter-dev, libavdevice-dev, libclang-dev, clang. Please note that installation of these dependencies may be quite difficult. Especially on macOS and Windows it takes expert knowledge to just get them installed without wasting several hours on endless stupid installation and compilation errors, which I can't help with. If you're cross-compiling, try uncommenting [patch.crates-io] section at the end of Cargo.toml, which includes some experimental fixes for ffmpeg.
Once you have dependencies installed, compile with cargo build --release --features=video or cargo build --release --features=video-static.
When compiled with video support ffmpeg licenses apply. You may need to have a patent license to use H.264/H.265 video (I recommend using VP9/WebM instead).
gifski -o out.gif video.mp4
Cross-compilation for iOS
The easy option is to use the included gifski.xcodeproj file to build the library automatically for all Apple platforms. Add it as a subproject to your Xcode project, and link with gifski-staticlib Xcode target. See the GUI app for an example how to integrate the library.
Cross-compilation for iOS manually
Make sure you have Rust installed via rustup. Run once:
rustup target add aarch64-apple-ios
and then to build the library:
rustup update
cargo build --lib --release --target=aarch64-apple-ios
The build may print "dropping unsupported crate type cdylib" warning. This is expected when building for iOS.
This will create a static library in ./target/aarch64-apple-ios/release/libgifski.a. You can add this library to your Xcode project. See gifski.app for an example how to use libgifski from Swift.
相關資源

resvg
CLI高保真 SVG 渲染库与命令行工具,可把 SVG 图标、插画按指定尺寸导出为 PNG,适合批量切图;不依赖系统库,各平台渲染结果逐像素一致。不支持 SVG 动画,安装需要 Rust 环境(cargo),也可从 Releases 下载 macOS 预编译版。
linebender/resvg4.1k
ImageMagick
CLI老牌图像处理命令行套件,支持 JPEG、PNG、GIF、TIFF、PDF 等众多格式的转换、缩放、裁剪、合成与批量处理,适合 agent 在脚本里处理图片。
ImageMagick/ImageMagick17.7k
libvips
CLI速度快、省内存的图像处理库,自带 vips 命令行,可批量缩放、裁剪、旋转、转换格式(WebP、AVIF、HEIC、TIFF 等)和生成缩略图,处理超大尺寸图片也不卡。适合设计和媒体团队批量处理素材,macOS 用 Homebrew 安装。
libvips/libvips11.7k
AI MediaKit CLI
CLI火山引擎官方媒体处理命令行,用法贴近 FFmpeg:加 --local 在本机免费裁剪、拼接、加字幕、混音、提取音频;默认走云端,可做画质增强、字幕擦除、语音转字幕、视频 OCR 等,附带 5 个 agent 技能。需要 Node.js 18+,本地模式需 FFmpeg,云端需火山引擎 API Key,按量计费。
volcengine/mediakit-cli211
HyperFrames
CLI用 HTML、CSS 与可逐帧定位的动画写视频,命令行预览并渲染成确定性的 MP4;附带产品发布视频、字幕、口播重剪等 agent 技能。HeyGen 官方维护,需要 Node.js 22+ 与 FFmpeg。
heygen-com/hyperframes65.2k
Rembg
CLI一条命令去除图片背景:支持单张、整个文件夹批处理和监听目录,可只输出蒙版、切换 U2Net、SAM 等模型,也能启动 HTTP 服务或配合 FFmpeg 处理视频帧。默认模型在本地推理。
danielgatis/rembg25.1k