October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Canvas

How to Convert HTML WebP Images to PNG

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a local WebP file, the shortest conversion is dwebp input.webp -o output.png. For a WebP image embedded in HTML, load the image in JavaScript, draw it to a canvas, and export the canvas as a PNG blob or data URL. The sections below show both workflows, including remote-image CORS limits, batch conversion, animated WebP caveats, and a no-browser API option.

Choose the conversion method

Situation Best method Why
One local WebP file dwebp Google’s WebP decoder writes PNG directly with one command.
Several files or additional edits ImageMagick The magick command can convert, resize, crop and process files in one workflow.
WebP referenced by an HTML page Browser JavaScript and canvas The browser decodes the image, then canvas serialization produces PNG.
Need a screenshot of the rendered page ScreenshotNeo It captures the page as PNG (or another supported format) without setting up a browser locally.

Convert a local WebP file with dwebp

Google documents dwebp as a command-line decoder: “Use dwebp on the command line to convert WebP image files to the PNG or PPM format.” PNG is its default output format.

  1. Install the WebP command-line tools for your operating system.
  2. Open a terminal in the directory containing the source file.
  3. Run:
dwebp input.webp -o output.png

Replace both names as needed. The command decodes the pixels; it does not preserve the original WebP container. Check that output.png exists and opens in an image viewer.

Useful path examples

dwebp "images/banner.webp" -o "images/banner.png"
dwebp "/home/alex/Downloads/photo.webp" -o "/home/alex/Downloads/photo.png"

Quote paths containing spaces. If the source is in a web page, first save the original WebP (or obtain its URL) rather than passing the page’s HTML file to dwebp; the decoder accepts image files, not HTML documents.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Animated WebP limitation

The documented dwebp tool does not support animated WebP. Do not expect the one-line command to preserve an animation. If motion matters, use a workflow that explicitly extracts frames and then assembles them into the required animated format, or export a single still frame when that is the actual requirement.

Convert WebP with ImageMagick

ImageMagick is useful when conversion is one step in a larger image job. After installing it, convert a file with:

magick input.webp output.png

You can combine conversion with other operations. For example, this resizes the image so its longest edge is 1,200 pixels before writing PNG:

magick input.webp -resize "1200x1200>" output.png

For a directory of files, run a shell loop (in a shell that supports it):

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
for f in *.webp; do magick "$f" "${f%.webp}.png"; done

Inspect the resulting dimensions, transparency and color appearance when the PNG is destined for print, design software or automated publishing. Different tools and versions can expose different image-profile and animation options, so check the command’s local documentation for those specialized cases.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Convert a WebP image embedded in HTML with JavaScript

An HTML page normally contains an <img> element whose src points to a WebP URL. The browser already decodes that source. To make PNG, draw the decoded image onto a canvas and ask the canvas for a PNG representation.

A complete local HTML converter

Save this as webp-to-png.html, open it in a browser, choose a WebP file, and click Download PNG. The file is processed locally in the page.

<!doctype html>
<meta charset="utf-8">
<title>WebP to PNG</title>
<label>Choose a WebP file: <input id="file" type="file" accept="image/webp,.webp"></label>
<p id="status"></p>
<img id="preview" alt="WebP preview" hidden>
<button id="download" type="button" disabled>Download PNG</button>
<script>
const fileInput = document.querySelector('#file');
const preview = document.querySelector('#preview');
const download = document.querySelector('#download');
const status = document.querySelector('#status');
let pngBlob;
let objectUrl;

fileInput.addEventListener('change', async () => {
  const file = fileInput.files[0];
  if (!file) return;
  if (objectUrl) URL.revokeObjectURL(objectUrl);
  objectUrl = URL.createObjectURL(file);
  preview.src = objectUrl;
  preview.hidden = false;
  download.disabled = true;
  status.textContent = 'Decoding…';

  try {
    const bitmap = await createImageBitmap(file);
    const canvas = document.createElement('canvas');
    canvas.width = bitmap.width;
    canvas.height = bitmap.height;
    const context = canvas.getContext('2d');
    context.drawImage(bitmap, 0, 0);
    bitmap.close();
    pngBlob = await new Promise((resolve, reject) =>
      canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error('PNG encoding failed')), 'image/png')
    );
    download.disabled = false;
    status.textContent = `${canvas.width} × ${canvas.height} PNG ready.`;
  } catch (error) {
    status.textContent = `Could not convert image: ${error.message}`;
  }
});

download.addEventListener('click', () => {
  if (!pngBlob) return;
  const url = URL.createObjectURL(pngBlob);
  const link = document.createElement('a');
  link.href = url;
  link.download = 'converted.png';
  link.click();
  setTimeout(() => URL.revokeObjectURL(url), 1000);
});
</script>

createImageBitmap() creates a decoded bitmap from the selected file. The canvas dimensions are set to the source dimensions, so the conversion does not resize the image. toBlob() creates a binary PNG suitable for download; use canvas.toDataURL('image/png') instead when an inline data URL is required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Convert an image already present on the page

If the page contains <img id="hero" src="photo.webp">, this function draws that element at its intrinsic size and downloads a PNG:

async function downloadImageAsPng(selector, filename = 'image.png') {
  const image = document.querySelector(selector);
  if (!image.complete || !image.naturalWidth) {
    await image.decode();
  }
  const canvas = document.createElement('canvas');
  canvas.width = image.naturalWidth;
  canvas.height = image.naturalHeight;
  canvas.getContext('2d').drawImage(image, 0, 0);
  const blob = await new Promise((resolve, reject) =>
    canvas.toBlob(value => value ? resolve(value) : reject(new Error('PNG encoding failed')), 'image/png')
  );
  const url = URL.createObjectURL(blob);
  const link = Object.assign(document.createElement('a'), { href: url, download: filename });
  link.click();
  setTimeout(() => URL.revokeObjectURL(url), 1000);
}

downloadImageAsPng('#hero');

This captures the image pixels, not surrounding HTML styling such as borders, captions or CSS filters. To capture the rendered page or a composed region, draw each required layer to the canvas or capture the page as a screenshot instead.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Convert a remote WebP URL in browser code

For an image hosted on another origin, fetch it as a blob and decode it before drawing:

async function webpUrlToPngBlob(sourceUrl) {
  const response = await fetch(sourceUrl, { mode: 'cors' });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const sourceBlob = await response.blob();
  const bitmap = await createImageBitmap(sourceBlob);
  const canvas = document.createElement('canvas');
  canvas.width = bitmap.width;
  canvas.height = bitmap.height;
  canvas.getContext('2d').drawImage(bitmap, 0, 0);
  bitmap.close();
  return new Promise((resolve, reject) =>
    canvas.toBlob(blob => blob ? resolve(blob) : reject(new Error('PNG encoding failed')), 'image/png')
  );
}

webpUrlToPngBlob('https://example.com/assets/photo.webp')
  .then(blob => {
    const url = URL.createObjectURL(blob);
    const link = Object.assign(document.createElement('a'), { href: url, download: 'photo.png' });
    link.click();
    setTimeout(() => URL.revokeObjectURL(url), 1000);
  })
  .catch(console.error);

The CORS restriction

The remote server must allow your page’s origin with an appropriate CORS response header. Without that permission, fetch() is rejected, or drawing a cross-origin image taints the canvas and prevents pixel export. Changing JavaScript’s mode does not grant permission. Use a same-origin proxy you control, download the file first, or perform the conversion server-side when the source cannot provide CORS access.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Preserve the details that matter

  • Transparency: PNG can represent transparent pixels. Check the result against the intended background because a viewer may display transparency differently.
  • Dimensions: Set canvas width and height from naturalWidth/naturalHeight or the decoded bitmap. Setting only CSS dimensions changes display size, not the exported pixel dimensions.
  • Quality: PNG encoding is lossless, but converting cannot restore detail already discarded when the WebP was created.
  • Color and metadata: If exact profiles, metadata or print output are important, inspect the converted file with the imaging tool used in your production pipeline rather than assuming every field transfers unchanged.
  • Memory: Large images require a canvas-sized pixel buffer plus an encoded PNG buffer. Convert in batches and release object URLs and bitmaps promptly.

Troubleshooting

“dwebp: command not found”

The WebP tools are not installed or their directory is not on your system path. Install the package for your operating system, reopen the terminal, and verify with dwebp -version.

The input is actually an HTML file

A saved web page may contain an <img> reference rather than image bytes. Open the page source or browser developer tools, copy the image URL, download the WebP, and then run the decoder.

Canvas export throws a security error

This is usually a cross-origin or CORS problem. Serve the image with permission for your origin, proxy it through a server you control, or use a local file/server-side conversion route.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

The PNG is blank or the wrong size

Wait for the image to finish decoding, use intrinsic dimensions, and draw only after image.decode() resolves or createImageBitmap() succeeds. Do not rely on an element’s CSS width and height for pixel dimensions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The output is a single frame

Animated WebP needs an animation-aware workflow. The basic dwebp command does not support animated WebP, and a one-canvas export is appropriate only when a still image is wanted.

Conversion fails for a very large image

Reduce the working dimensions, process one file at a time, close bitmaps, revoke object URLs, and allow enough memory for both decoded pixels and the PNG result. For repeatable server jobs, use a command-line or image-processing pipeline instead of a browser tab.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your real goal is a PNG of the page that contains the WebP, ScreenshotNeo makes one API request and returns a screenshot. It accepts cookie and consent banners like a visitor, removes more than 60 known consent platforms plus newsletter popups and chat widgets before capture, and lets you turn each cleanup step off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; response headers identify the page verdict and whether it was billed. Its MCP server also gives Claude, Cursor and other MCP clients take_screenshot, get_page_info and capture_pdf tools.

Use the PNG output option in the request when you need image bytes. The API documentation is at https://screenshotneo.com/docs/.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/page-with-webp -o shot.png

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com/page-with-webp"},
    timeout=90,
)
r.raise_for_status()
open("shot.png", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://example.com/page-with-webp'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.png', buffer);

Every plan includes all features. The Free plan provides 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to get an API key.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Which workflow should you use?

  • Use dwebp for a quick local, still-image conversion.
  • Use ImageMagick when conversion belongs with resizing, batch jobs or other image operations.
  • Use canvas when JavaScript in the page must turn an image URL or selected file into a PNG in the browser.
  • Use a screenshot API when you need the rendered page, cleanup of overlays, or an automated service rather than a browser utility.

FAQ

Can I change a WebP URL to end in .png?

No. Renaming the extension does not change the encoded bytes. Decode and re-encode the image with one of the methods above.

Does PNG always look sharper than WebP?

No. PNG is lossless for the pixels it receives, but it cannot recover detail that a lossy WebP source already removed.

Can I convert an image without uploading it?

Yes. The file-input HTML utility and local command-line tools process the source on your computer. A remote browser conversion still depends on the source server’s CORS policy.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I convert a WebP image directly inside an HTML page?

Yes. Decode the image, draw it to a canvas, and export the canvas with PNG serialization; the complete browser example is included above.

Why does my remote image fail while a local file works?

The remote origin likely does not grant CORS permission, which blocks fetching or canvas pixel export. Use a permitted source, a proxy you control, or local/server-side conversion.

Will dwebp preserve an animated WebP?

No. Google’s documented dwebp tool does not support animated WebP; use an animation-aware frame conversion workflow when motion must be retained.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.