LinuxCommandLibrary

gif2webp

Convert GIF images to WebP format

TLDR

Convert a GIF image to WebP

$ gif2webp [path/to/image.gif] -o [path/to/image.webp]
copy

SYNOPSIS

gif2webp [options] input.gif -o output.webp

PARAMETERS

-h, --help
    Display usage help and exit

--version
    Print version information and exit

-o filename
    Set output WebP filename (required)

-q quality
    Quality factor 0-100 (default: 100 for lossless, affects lossy)

-m method
    Compression method 0=fastest to 6=slowest (default: 4)

-loop count
    Loop count for animation (0=infinite, default: 0)

--min-size
    Minimize output size variation

-mt
    Enable multi-threaded encoding (auto-detects cores)

-v, --verbose
    Verbose output

--quiet
    Suppress all output

-short
    Use short frame delays (<65s)

-no-multiply
    Disable pixel multiplier for palette

--delta-palette
    Use delta palettes when possible

DESCRIPTION

gif2webp is a command-line utility from Google's libwebp tools suite for converting GIF images—including animated ones—to the efficient WebP format. WebP provides better compression than GIF, reducing file sizes by 25-34% without visible quality loss in lossless mode (default). It excels with animations by preserving frame timings, disposal methods, transparency, and loops.

Key strengths include support for lossless, lossy, and mixed modes; adjustable quality (0-100); compression methods from fast to slow; and multi-threading for speed on modern CPUs. Output is optimized for web use, with options to minimize size or simplify delays. Ideal for optimizing assets in web development, apps, or archiving. Requires input GIF and outputs a single WebP file; handles transparency and palettes efficiently via delta palettes when possible.

CAVEATS

Only supports GIF input; animated WebP browser support varies (Chrome/Firefox good, Safari partial); no batch mode for multiple inputs to one output; requires libwebp installed.

EXAMPLES

Lossless: gif2webp input.gif -o output.webp
Lossy fast: gif2webp -q 75 -m 0 -mt input.gif -o output.webp
Minimal size: gif2webp --min-size -loop 10 input.gif -o output.webp

HISTORY

Introduced in 2010 with Google's WebP project as part of libwebp tools. Evolved through versions (e.g., 0.1.0 to 1.3+), adding multi-threading, delta palettes, and size optimizations for better animated WebP efficiency.

SEE ALSO

cwebp(1), dwebp(1), webpmux(1), convert(1)

Copied to clipboard