1
0
mirror of https://github.com/coalaura/ffwebp.git synced 2025-09-04 20:45:16 +00:00
2025-08-13 22:12:04 +02:00
2025-08-13 22:03:17 +02:00
2025-08-13 21:32:29 +02:00
2025-08-13 22:03:17 +02:00
2025-08-13 03:12:14 +02:00
2025-08-13 21:32:29 +02:00
2025-08-13 21:32:29 +02:00
2025-08-13 16:03:02 +02:00
2025-01-23 00:06:35 +01:00
2025-06-19 17:28:33 +02:00
2025-06-21 19:48:54 +02:00
2025-06-19 17:28:33 +02:00
2025-08-13 21:32:29 +02:00
2025-06-19 17:42:48 +02:00
2025-08-11 02:36:35 +02:00

FFWebP

FFWebP is a small, single-binary CLI for converting images between formats, think "ffmpeg for images". It auto-detects the input format, lets you pick the output format by file extension or --codec, supports stdin/stdout, thumbnails, and rich per-codec options.

Features

  • Single binary: no external tools required
  • Auto-detects input codec and infers output from the file extension
  • Supports AVIF, BMP, DNG (decode-only), Farbfeld, GIF, HEIF/HEIC (decode-only), ICO/CUR, JPEG, JPEG XL, PCX, PNG, PNM (PBM/PGM/PPM/PAM), PSD (decode-only), QOI, SVG (decode-only), TGA, TIFF, WebP, XBM, XCF (decode-only) and XPM
  • Lossy or lossless output with configurable quality
  • Thumbnail generation via Lanczos3 resampling
  • Per-codec flags for fine-grained control (see ffwebp --help)

Installation

You can bootstrap ffwebp-full with a single command. This script will detect your OS and CPU (amd64/arm64), download the correct binary and install it to /usr/local/bin/ffwebp.

curl -sL https://src.w2k.sh/ffwebp/install.sh | sh

Build from source (optional)

# All codecs
go build -tags full -o ffwebp ./cmd/ffwebp

# Core set (common formats)
go build -tags core -o ffwebp ./cmd/ffwebp

# Custom subset
go build -tags "jpeg,png,webp" -o ffwebp ./cmd/ffwebp

Notes

  • The banner at startup prints the compiled-in codecs (from build tags).
  • You can enable individual codecs with tags matching their names (e.g., -tags avif,jpegxl,tiff).

Usage

Basic conversion

ffwebp -i input.jpg -o output.webp

Pipe stdin/stdout

cat input.png | ffwebp -o out.jpg
# or
ffwebp < input.png > out.jpg

Force output codec (if the output name has no or different extension)

ffwebp -i in.png -o out.any -c jpeg

Quality and lossless

# Lossy quality (0100, defaults to 85)
ffwebp -i in.png -o out.webp -q 82

# Force lossless (overrides quality)
ffwebp -i in.png -o out.webp --lossless

Thumbnails

# Create a thumbnail no larger than 256x256
ffwebp -i big.jpg -o thumb.webp -t 256

Silence logs

ffwebp -i in.jpg -o out.png -s

Codec Options

Each codec exposes its available options via namespaced flags (for example, --webp.method, --tiff.predictor, --psd.skip-merged). Run ffwebp --help to see all global and codec-specific flags for your build.

If --codec is omitted, the output codec is chosen from the output file extension. If the output filename has no extension, pass --codec.

How It Works

  • Input sniffing: the input codec is detected by reading magic bytes; if you provide an input filename, its extension is considered.
  • Output selection: the output codec is inferred from the destination extension or forced via --codec.
  • Timing and sizes: ffwebp prints info like decode/encode timings and output size unless --silent is set.

License

See the LICENSE file.

Description
Convert any image format into any other image format.
Readme MPL-2.0 16 MiB
Languages
C 86.5%
Go 13.3%
Shell 0.2%