LinuxCommandLibrary

webpmux

Create animated WebP images

TLDR

Create a two-frame animation

$ webpmux -frame [path/to/frame1.webp] +[500] -frame [path/to/frame2.webp] +[500] -loop [0] -o [path/to/output.webp]
copy

SYNOPSIS

webpmux [options] input_webp
webpmux -mux input_webp -frame frame_options [-frame frame_options ...] [global_options] -o output_webp
webpmux -extract frame_number input_webp -o output_webp
webpmux -get element input_webp -o output_file
webpmux -set element input_file input_webp -o output_webp
webpmux -info input_webp

PARAMETERS

-h, -help
    Show help message and exit.

-version
    Show version number and exit.

-mux
    Enable muxing mode to create an animated WebP. Requires -frame option(s).

-frame file +duration[+offset]
    Add an input frame for muxing. Specifies the WebP file, its duration in ms, and optionally an offset.

-loop loops
    Set the number of loops for the animation (0 means infinite).

-bgcolor AARRGGBB
    Set the background color of the animation canvas in hex format (Alpha, Red, Green, Blue).

-extract frame_number
    Enable extraction mode to save a specific frame from an animated WebP.

-get element
    Enable mode to extract a specific element (icc, exif, xmp) from a WebP file.

-set element input_file
    Enable mode to set a specific element (icc, exif, xmp) from input_file into a WebP file.

-info
    Print information about the structure of the WebP file.

-o output_webp
    Specify the output WebP file name.

DESCRIPTION

The webpmux command is a utility provided with the libwebp library for creating and manipulating WebP files. Its primary functions include muxing (multiplexing) static WebP images into an animated WebP file, extracting individual frames from an animated WebP, and handling metadata like ICC profiles, EXIF, and XMP data.
You can use webpmux to define the display duration and other properties for each frame when creating an animation. It supports adding global properties like loop count and background color.
Besides animation, it allows you to inspect the structure of a WebP file and get or set specific metadata elements, making it a versatile tool for working with the WebP format beyond simple encoding and decoding.

CAVEATS

Input files provided to the -frame option for muxing must be valid static WebP files.
Frame numbers for extraction using -extract are 1-based.
Metadata elements like EXIF and XMP have specific file formats they must adhere to when using -set.

FRAME SPECIFICATION FORMAT:

The -frame option uses the format file +duration[+offset]. file is the input WebP frame, duration is the display time in milliseconds, and the optional offset specifies its position on the canvas relative to the previous frame (or canvas origin for the first frame).

SUPPORTED ELEMENTS FOR GET/SET:

The -get and -set options support the following elements:icc (ICC profile), exif (EXIF metadata), xmp (XMP metadata).

HISTORY

webpmux is part of the official libwebp distribution developed by Google. It was introduced to provide capabilities for manipulating WebP files beyond simple encoding and decoding, specifically enabling the creation and management of animated WebP images and associated metadata after the animated WebP specification was finalized.

SEE ALSO

cwebp(1), dwebp(1)

Copied to clipboard