LinuxCommandLibrary

dwebp

Decode WebP images to other formats

TLDR

Convert a WebP file into a PNG file

$ dwebp [path/to/input.webp] -o [path/to/output.png]
copy

Convert a WebP file into a specific filetype
$ dwebp [path/to/input.webp] -bmp|-tiff|-pam|-ppm|-pgm|-yuv -o [path/to/output]
copy

Convert a WebP file, using multi-threading if possible
$ dwebp [path/to/input.webp] -o [path/to/output.png] -mt
copy

Convert a WebP file, but also crop and scale at the same time
$ dwebp [input.webp] -o [output.png] -crop [x_pos] [y_pos] [width] [height] -scale [width] [height]
copy

Convert a WebP file and flip the output
$ dwebp [path/to/input.webp] -o [path/to/output.png] -flip
copy

Convert a WebP file and don't use in-loop filtering to speed up the decoding process
$ dwebp [path/to/input.webp] -o [path/to/output.png] -nofilter
copy

SYNOPSIS

dwebp [options] <input_file.webp> [-o <output_file>]

PARAMETERS

-o
    Specify the name of the output file. If omitted, the decoded image will be written to standard output.

-version
    Print the version number of the libwebp library being used.

-h, -help
    Display a short usage summary.

-short
    Display a very short usage summary.

-png
    Output the decoded image as a PNG file. This is often the default or preferred output format for transparency support.

-ppm
    Output the decoded image as an uncompressed PPM file (for RGB) or PGM file (for grayscale), primarily for simple viewing or processing.

-tiff
    Output the decoded image as an uncompressed TIFF file.

-yuv
    Output the raw YUV planes as a YUV file. Useful for video processing workflows.

-crop
    Crop the decoded image to a rectangle starting at (x, y) with the specified width and height.

-scale
    Scale the decoded image to the specified width and height.

-resize
    Alias for -scale, resizes the decoded image.

-alpha_q
    Specify the alpha quantization factor (0-100) for transparency (lossy compression). A value of 0 means no alpha compression.

-blend_alpha
    Blend the alpha channel with a background color (default is black) instead of preserving it as a separate channel.

-nofancy
    Disable the fancy YUV420 upsampling method, which might make decoding slightly faster but with potentially lower quality.

-dither
    Apply dithering to the decoded image (0-100), to reduce banding artifacts, especially in images with limited color palettes.

-no_dither
    Disable dithering (equivalent to -dither 0).

-use_threads, -mt
    Use multi-threading for faster decoding on multi-core systems.

-no_metadata
    Do not copy any metadata (EXIF, ICC, XMP) from the input WebP file to the output file.

-no_icc
    Do not copy ICC profile metadata.

-no_exif
    Do not copy EXIF metadata.

-no_xmp
    Do not copy XMP metadata.

-info
    Print information about the input WebP file (e.g., dimensions, alpha presence, animation properties) without decoding the image data.

-v
    Enable verbose output, showing more details about the decoding process.

-quiet
    Suppress all non-error output.

DESCRIPTION

dwebp is a command-line tool that decodes WebP image files into various common image formats such as PNG, PPM, TIFF, or YUV. It is an integral part of the official libwebp library, developed by Google, which provides comprehensive utilities for handling the WebP image format.

This utility is essential for converting WebP images for applications or environments that do not natively support the format, or for further processing with other image manipulation tools. It offers various options for controlling the decoding process, including scaling, cropping, dither control, alpha blending, and metadata handling, making it a versatile and powerful tool for diverse image conversion and manipulation tasks. It can also be used to inspect WebP file properties.

CAVEATS

dwebp consumes memory proportional to the image size and complexity, especially when dealing with very large images or animated WebP files. Decoding animated WebP images can be resource-intensive.

While dwebp aims for fidelity, the quality of the output depends on the original WebP encoding parameters. Lossy WebP files will result in lossy decoded images. Compatibility with all WebP features (e.g., extended format, certain color profiles) might vary with libwebp versions.

SUPPORTED OUTPUT FORMATS

Beyond the explicitly mentioned PNG, PPM, and TIFF, dwebp can also output raw YUV data. The specific format depends on the command-line option used. If no output format is specified and an output file is given, dwebp often defaults to PNG for images with alpha channels or PPM/PGM for opaque images, depending on the libwebp build configuration.

ANIMATED WEBP DECODING

For animated WebP images, dwebp can decode individual frames. By default, it decodes only the first frame. Options like -loop and -time might be available in newer versions to control which frames of an animation are decoded, or to limit processing time for animated files.

HISTORY

WebP, and consequently the dwebp utility, was developed by Google and first announced in 2010 as a new image format for the web, aiming for smaller file sizes with comparable quality to existing formats like JPEG and PNG. dwebp emerged as the primary tool to convert these WebP images back into widely supported formats, facilitating adoption and integration into existing workflows. Its development has closely tracked the evolution of the WebP format, adding support for features like animation (animated WebP) and extended format capabilities over time, continuously improving its decoding efficiency and feature set.

SEE ALSO

cwebp(1), webpinfo(1), gif2webp(1), img2webp(1), vwebp(1)

Copied to clipboard