dwebp is Google's official WebP decoder. Convert WebP to PNG, PPM, or TIFF, and crop, scale, or flip during decoding. Full command reference with examples.
dwebp: Decoding and Previewing WebP Files
dwebp is Google's official command-line decoder for WebP, shipped in the libwebp package. It converts .webp files back to PNG, PPM, PAM, BMP, or TIFF, and can crop, scale, or flip the image while decoding. This guide is a practical reference for inspecting WebP files and converting them to other formats from the terminal.
For the encoder counterpart, see cwebp Command-Line Tool: Full Reference Guide. To convert WebP without installing anything, use WebP to PNG and WebP to JPG.
What is dwebp?
dwebp is the reference WebP decoder maintained by Google as part of the libwebp library. It reads a .webp file and writes an image in a conventional format, so WebP files can be opened by tools that do not support WebP natively. It is the inverse of cwebp.
dwebp decodes both lossy and lossless WebP, including transparency. For animated WebP, a separate tool — anim_dump — extracts frames.
What is the basic dwebp command?
The basic command takes a WebP input and an output path. By default dwebp writes a PNG. The -o flag names the output file.
dwebp input.webp -o output.png
This decodes input.webp to output.png, preserving any alpha channel. Without -o, dwebp can write to standard output for use in pipelines.
Which output formats does dwebp support?
dwebp writes several uncompressed and lossless formats, selected by a format flag. PNG is the default and the most useful for general conversion. The others suit specific pipelines and image-processing tools.
The format flags are:
-png— PNG output (default), preserves transparency.-bmp— Windows BMP.-tiff— TIFF.-ppm— PPM (no alpha).-pam— PAM (with alpha).-pgm— PGM, dumping the internal YUV as grayscale.
dwebp input.webp -tiff -o output.tiff
How do you crop or scale while decoding?
Pass -crop or -scale to transform the image during decoding, avoiding a separate processing step. -crop extracts a rectangle; -scale resizes to a target width and height.
dwebp input.webp -crop 100 100 800 600 -o cropped.png # x y width height
dwebp input.webp -scale 1200 0 -o scaled.png # 0 preserves aspect ratio
Using 0 for one -scale dimension preserves the aspect ratio, mirroring the resize behaviour in cwebp.
How do you inspect a WebP file's properties?
Use webpinfo to print a WebP file's structure and dwebp -v for decode timing and dimensions. webpinfo reports the chunks, dimensions, and whether the file is lossy, lossless, animated, or has alpha — useful for debugging.
webpinfo input.webp
dwebp -v input.webp -o output.png
The chunk structure webpinfo reports is explained in WebP File Structure: RIFF Container and Chunk Format.
How do you preview a WebP file?
Use vwebp, libwebp's lightweight viewer, to open a WebP file in a window without converting it. vwebp renders lossy, lossless, and animated WebP, and shows transparency against a checkerboard. It is the fastest way to confirm a file decoded correctly.
vwebp input.webp
For a quick conversion to a universally viewable format instead, decode to PNG with the basic command above, or use WebP to PNG in the browser.
Where to go from here
- cwebp Command-Line Tool: Full Reference Guide
- libwebp Library: Installation and API Reference
- WebP File Structure: RIFF Container and Chunk Format
- What is WebP? A Complete Guide to the WebP Image Format
- No-install alternative: WebP to PNG, WebP to JPG
dwebp turns any WebP back into a standard format from the terminal, with cropping, scaling, and inspection built in. For one-off conversions, the browser-based tools are quicker.