Article
WebP to PNG on the Command Line: Windows, Mac, and Linux Methods
Convert WebP to PNG from the command line using dwebp, ImageMagick, and ffmpeg on Windows, macOS, and Linux. Includes batch conversion scripts and when to use a no-install browser tool instead.
If you save a lot of images from the web, you probably have folders full of .webp files that your older software, email client, or design tool refuses to open. Converting them to PNG fixes the compatibility problem, and doing it on the command line lets you automate the whole thing.
This guide covers every reliable command-line method for WebP to PNG conversion across Windows, macOS, and Linux — and explains when a zero-install browser converter is actually the faster choice.
The three tools worth knowing
There are many CLI image tools, but for WebP to PNG only three are worth your time:
dwebp— Google’s official WebP decoder, part of thelibwebppackage. It is the most accurate because it is built by the format’s creators. Outputs lossless PNG.- ImageMagick (
magick) — A general-purpose image suite that handles hundreds of formats. Great when you also want to resize, rename, or batch-process in one step. ffmpeg— Best known for video, but it decodes WebP and writes PNG too. Useful if you already have it installed for media work.
All three preserve the alpha (transparency) channel, so transparent WebP images stay transparent after conversion.
Convert WebP to PNG on Linux / Ubuntu
Most distributions do not ship a WebP decoder by default. Install one of the tools above, then run a single command.
Using dwebp (libwebp)
# Ubuntu / Debian
sudo apt update && sudo apt install webp
# Fedora
sudo dnf install libwebp-tools
# Arch
sudo pacman -S libwebp
Then convert:
dwebp input.webp -o output.png
dwebp decodes the WebP pixel-for-pixel and writes a lossless PNG. If the source was a lossless WebP, the PNG is identical.
Using ImageMagick
sudo apt install imagemagick
magick input.webp output.png
On older systems, ImageMagick v6 uses the
convertcommand instead ofmagick(convert input.webp output.png). v7 unified everything undermagick.
Using ffmpeg
ffmpeg -i input.webp output.png
For a deeper look at Linux-specific options and the graphical route, see our WebP to PNG on Linux guide.
Convert WebP to PNG on macOS
The fastest way on a Mac is Homebrew:
# Install the tool you prefer (pick one)
brew install webp # provides dwebp
brew install imagemagick # provides magick
brew install ffmpeg # provides ffmpeg
Then the commands are identical to Linux:
dwebp input.webp -o output.png
# or
magick input.webp output.png
# or
ffmpeg -i input.webp output.png
For Mac users who would rather not touch the terminal at all, our WebP to PNG on Mac guide walks through the drag-and-drop alternative.
Convert WebP to PNG on Windows
Windows gives you two paths: native command-line tools, or PowerShell.
Install a decoder
# ImageMagick via winget
winget install ImageMagick.ImageMagick
# Or Google's libwebp — download the zip from developers.google.com/speed/webp
# and add the extracted folder to your PATH
Single-file conversion (PowerShell or Command Prompt)
magick input.webp output.png
# or, with libwebp on your PATH
dwebp input.webp -o output.png
For more Windows options including the built-in Paint method, see WebP to PNG on Windows.
Batch convert many WebP files at once
This is where the command line genuinely beats a manual browser workflow. If you have a folder with dozens of WebP images, a one-line loop converts them all.
Batch with ImageMagick mogrify (all platforms)
magick mogrify -format png *.webp
mogrify reads every .webp in the current folder and writes a matching .png next to it, keeping the original.
Batch with dwebp (Linux / macOS)
for f in *.webp; do dwebp "$f" -o "${f%.webp}.png"; done
Batch with PowerShell (Windows)
Get-ChildItem -Filter *.webp | ForEach-Object {
magick $_.FullName ($_.BaseName + ".png")
}
Does command-line conversion lose quality?
No. All three tools decode the WebP and re-encode the pixels as PNG, which is a lossless format. The output is a pixel-perfect match of what the WebP decoder produced. There is no generation loss. For the full explanation of why PNG keeps quality intact, read our WebP to PNG without losing quality guide.
Transparent regions are preserved too — the alpha channel is copied straight through. See our transparent background guide if your images have transparency you need to keep.
When to skip the terminal and use a browser tool
The command line is unbeatable for batch jobs and automation. But for a single quick conversion, installing a package and remembering syntax is overkill. A browser-based converter needs no install, no PATH editing, and no terminal — you just open the page, drop the file, and download the PNG.
FreePNGConvert does exactly this. The conversion runs entirely in your browser using the Canvas API, so the file never leaves your device. It is free and has no file limit. For the privacy angle and how an offline-capable browser tool compares, see our WebP to PNG offline guide.
| Situation | Best choice |
|---|---|
| Convert 1–3 files, no install wanted | Browser tool (freepngconvert.com) |
| Convert a folder of 50+ WebP files | magick mogrify -format png *.webp |
| Scripting / CI pipeline | dwebp or magick |
| Server without a GUI | dwebp (smallest dependency) |
Common questions
Which command-line tool produces the smallest, cleanest PNG?
dwebp is the most faithful because it is Google’s official decoder. ImageMagick and ffmpeg produce visually identical output but may add slightly different PNG metadata. For web delivery the difference is negligible.
Can I convert WebP to PNG without installing anything?
Yes. A browser-based tool like FreePNGConvert requires no installation — it converts in your browser. For repeated or batch use, a local CLI tool is more convenient.
Do these commands keep transparency?
Yes. dwebp, magick, and ffmpeg all preserve the alpha channel, so transparent areas in the WebP stay transparent in the PNG.
What about WebP animations?
Static WebP converts cleanly with all three tools. Animated WebP is a different case — each tool handles frame extraction differently, and a single PNG can only hold one frame. For animated sources you usually want a GIF or a sprite sheet instead.
Is the browser method as accurate as the command line?
Functionally, yes. The browser’s Canvas API decodes the WebP pixel-by-pixel, the same pixel data that dwebp produces. The result is a lossless PNG in both cases. For more, see our WebP vs PNG quality comparison.
Last updated: 2026-06-15