Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Chrome Headless

How to Convert HTML to JPG or PNG (Browser, Playwright, and API Methods)

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

To convert HTML to a JPG or PNG, render it in a browser engine and save a screenshot. HTML is not an image file by itself: CSS, fonts, JavaScript, and remote assets must be laid out before pixels can be exported. For a one-off URL, Chrome Headless is quickest. For repeatable automation, Playwright provides viewport, full-page, and element screenshots with PNG, JPEG, and WebP output. If you do not want to maintain a browser, a hosted API such as ScreenshotNeo can perform the render and return the image.

Choose the conversion method

Need Best route Input
One quick capture from a public URL Chrome Headless URL
Repeatable scripts, tests, or builds Playwright URL, local file, or generated HTML
PHP application already using Puppeteer Spatie Browsershot URL, HTML string, or local path
A legacy command-line renderer wkhtmltoimage URL or HTML file
No browser installation or maintenance ScreenshotNeo URL through an API

For sensitive HTML, decide whether sending content to an online service is acceptable and review that provider’s current privacy and retention terms. The documentation for the tools above does not establish a universal winner for fidelity, speed, security, or maintenance.

Convert a URL with Chrome Headless

Chrome’s headless mode includes a --screenshot flag. Set a viewport with --window-size; use --timeout when a page may continue loading.

  1. Install a current Chrome or Chromium build.
  2. Run a capture command, replacing the URL and output path:
google-chrome --headless --disable-gpu --window-size=1440,1000 --screenshot=page.png https://example.com

On systems where the executable is named differently, use chromium or chromium-browser. The command captures the viewport, not automatically the entire scrollable document. Flag behavior can vary by installed Chrome version, so verify the current command-line reference if an option is rejected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
  • Convert over 50 document file formats.
  • Preview your files from Doxillion before converting them.
  • Use batch conversion to convert thousands of files at once.
  • Enjoy an easy-to-use, intuitive interface with a Drag and Drop file option.
  • Burn your converted or original files directly to disc.

JPEG output

Use a JPG filename when your installed Chrome version supports selecting the screenshot format, or capture PNG and convert it with an image utility. PNG is lossless and can preserve transparency in workflows that support it; JPEG is lossy but lets you trade quality for file size. Do not save a screenshot with a .jpg extension unless the bytes are actually JPEG.

Timing problems

A page can still be loading images or running JavaScript when the screenshot is taken. Increase the timeout where supported, wait for the page to settle, and inspect the resulting image. A command-line capture does not guarantee that every asynchronous element has appeared.

Use Playwright for reliable automation

Playwright drives a real browser and exposes screenshot options for output type, scope, scale, quality, and background. Install it in a Node.js project:

npm init -y
npm install playwright
npx playwright install chromium

Complete Node.js example

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage({
    viewport: { width: 1440, height: 1000 },
    deviceScaleFactor: 1
  });

  await page.goto('https://example.com', { waitUntil: 'networkidle', timeout: 90000 });
  await page.screenshot({ path: 'page.png', type: 'png' });
  await page.screenshot({ path: 'page.jpg', type: 'jpeg', quality: 85 });
  await browser.close();
})();

Playwright’s documented screenshot types are PNG, JPEG, and WebP; PNG is the default. JPEG quality ranges from 0 to 100, with a documented default of 80. The quality option applies to JPEG, not PNG.

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.

Capture the full scrollable page

await page.screenshot({ path: 'full-page.png', fullPage: true });

Use fullPage: true when the image must include content below the viewport. Very long pages can produce very large images; consider splitting the document or using a PDF when a paginated deliverable is more useful.

Rank #2
AVCHD Video Converter: Edit and Convert Files from over 50 Formats into any Video or Audio Format - Great Program for Video Cutting
  • The ALL-IN-ONE solution for your video conversion needs: With this software you can convert files to any video format of your choice - the ideal complement for editing, converting or cutting videos
  • Supported input formats: Video: MPG, MPEG, MPEG 2, VOB, DAT, MP4, M4V, TS, RM, RMVB, WMV, ASF, MKV, AVI, 3GP, 3G2, FLV, SWF, MPV, MOD, TOD, QT, MOV, DV, DIF, MJPG, MJPEG / HD Videos: HD TS, HD MTS, HD M2TS, HD MPG, HD MPEG, HD MP4, HD WMV, QuickTime HD MOV, HD H.264, HD RM / Audio: MP3, MP2, AAC, AC3, WAV, WMA, M4A, RM, RAM, OGG, AU, AIF, AIFF, APE, FLAC, NUT
  • Supported output formats: VIDEO: MPEG-4, H.264/MPEG-4 AVC, MOV, M4V, AVI, DivX, XviD, ASF, WMV, MPEG-1, MPEG-2, 3GP, 3GPP, MKV, FLV, SWF, VOB, DV, Super VCD(NTSC, PAL, SECAM), VCD(NTSC, PAL, SECAM), DVD(NTSC, PAL, SECAM) /
  • HD video: HD H.264, HD AVI, HD MPG, HD TS, HD WMV, HD MPEG 4, HD MOV, HD ASF / 3D VIDEO: MP4 3D, MP4 Anaglyph 3D, MKV 3D, MKV Anaglyph 3D, TS 3D, AVI 3D, FLV 3D / AUDIO: AAC, AC3, AIFF, AMR, AU, FLAC, M4A, MKA, MP2, MP3, OGG, WAV, WMA
  • For Windows 11, 10, Windows 8, Windows 7, Windows Vista, Windows XP (SP2 or later)

Capture one element

const card = page.locator('.pricing-card');
await card.screenshot({ path: 'pricing-card.png' });

An element screenshot is useful for a chart, product card, invoice, or component rather than the whole page. The locator must resolve to a visible element; wait for it when it is created dynamically.

Transparent backgrounds and scale

await page.screenshot({
  path: 'transparent.png',
  omitBackground: true,
  scale: 'css'
});

omitBackground can preserve transparency for PNG, but it does not apply to JPEG. Use scale: 'css' for CSS-pixel dimensions or scale: 'device' for device-pixel output. A higher device scale can improve sharpness while increasing dimensions and memory use.

Wait for dynamic content explicitly

await page.goto('https://example.com/dashboard', { waitUntil: 'domcontentloaded' });
await page.locator('[data-loaded="true"]').waitFor({ state: 'visible', timeout: 30000 });
await page.waitForTimeout(500);
await page.screenshot({ path: 'dashboard.png', fullPage: true });

Prefer a meaningful selector or application signal over an arbitrary delay. Network-idle waiting can be unsuitable for pages with analytics or long-lived connections. Always inspect the saved image for missing fonts, images, or late-rendered widgets.

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

Convert local HTML or an HTML string

For generated HTML, write a temporary file and navigate to its file URL, or serve it from a local development server. A file URL may block remote assets or behave differently from production; a local HTTP server often gives more predictable relative paths and CORS behavior.

const fs = require('fs');
const { chromium } = require('playwright');

(async () => {
  fs.writeFileSync('/tmp/report.html', '<!doctype html><h1>Report</h1>');
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('file:///tmp/report.html', { waitUntil: 'load' });
  await page.screenshot({ path: 'report.png' });
  await browser.close();
})();

When the HTML references local CSS, fonts, or images, use absolute paths or serve all assets from the same local origin. Missing assets are a rendering problem, not an image-format problem.

Rank #3
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
  • Convert your PDF files into Word, Excel & Co. the easy way
  • Convert scanned documents thanks to our new 2022 OCR technology
  • Adjustable conversion settings
  • No subscription! Lifetime license!
  • Compatible with Windows 11, 10, 8.1, 7 - Internet connection required

Other software routes

Spatie Browsershot

Browsershot accepts a URL, an HTML string, or a local file path and uses Puppeteer with headless Chrome. It is convenient in PHP applications already using that stack. Its documentation does not establish comparative performance or that it is preferable for every project.

wkhtmltoimage

wkhtmltoimage is an open-source headless Qt WebKit command-line tool that renders HTML to image formats. The project information commonly surfaced for it is old, so confirm current maintenance, JavaScript support, and security suitability before adopting it for new production work.

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

PNG or JPG: which should you use?

Requirement Choose Reason
Transparency PNG Playwright’s omitBackground option does not apply to JPEG.
Exact text, diagrams, or repeated editing PNG Avoids JPEG’s lossy compression.
A specifically required photo-style format JPEG Set a quality value from 0–100.
Modern browser delivery where supported WebP Playwright documents WebP as an available screenshot type.

There is no universal rule that one format is always smaller or sharper. Compare the actual output at the dimensions your application needs.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request renders a URL and returns PNG, JPEG, WebP, or PDF. It accepts consent banners like a visitor, then removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

It also supports full-page and CSS-selector element capture, dark mode, 12 device presets or a custom viewport, retina scale, PDF paper settings and page ranges, HTML/CSS input, custom JavaScript and CSS, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, an OpenAPI specification, and familiar parameter names used by other screenshot APIs.

cURL

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

Python

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

Node.js

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

See the parameter reference and advanced examples in the ScreenshotNeo documentation. An MCP server lets Claude, Cursor, and other MCP clients call take_screenshot, get_page_info, and capture_pdf directly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Video Converter Software compatible with Windows 11, 10, 8 and 7 – Easily convert video and audio files even in HD, 4K and 3D – Edit and improve your videos
  • Easy and fast conversion without a loss of quality
  • Support of all the common video and audio formats
  • Including a variety of helpful editing tools
  • Support of more than 130 file formats, more than 40 presets for various devices (Smartphones, Smart TVs)
  • Compatible with Windows 11, 10, 8.1, 7

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; Growth is $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan. Create a free ScreenshotNeo account to start.

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

Troubleshooting missing or incorrect images

Blank or partially blank output

Check that the URL is reachable from the machine running the browser, wait for a meaningful selector, and verify that scripts are not failing. Authentication, geolocation, and bot protection can make a page look different outside your normal browser.

Images or fonts are missing

Inspect network errors, use absolute asset URLs, wait for the relevant image or font, and ensure local files are readable. A screenshot taken before web fonts load may show fallback text and different line wrapping.

The page is cut off

Use fullPage: true for the complete scrollable page or capture a specific element. For infinite scrolling, trigger the application’s loading behavior before capture; no generic screenshot flag can know when an infinite feed is complete.

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

JPEG looks blurry

Raise JPEG quality, increase the viewport or device scale, or switch to PNG for text-heavy graphics. Do not expect JPEG to preserve the same detail as a lossless PNG.

Best Value
Nero Recode | MP3 & MP4 Converter Software | Audio & Video Converter | DVD Ripping, MP3, WAV, FLAC, MP4, AVI, MOV | Lifetime License | 1 PC | Windows 11 / 10
  • ✔️ Convert All Your Media with Ease: Nero Recode supports a wide range of formats, including MP4, AVI, MOV, MP3, WAV, FLAC, and more, making it the ultimate solution for converting videos, audio, and DVDs for any device.
  • ✔️ High-Quality 8K Video Processing: With full support for HEVC/H.265, you can efficiently process and convert 8K video without compromising on quality, making it ideal for high-end cameras and modern smartphones. m2v, mmv
  • ✔️ Rip DVDs & Blu-rays to Digital: Rip your DVDs and Blu-ray discs to popular formats like MP4 and MP3 for easy digital storage and playback on all devices.
  • ✔️ High-Speed Conversion: Enjoy fast processing and high-quality output with batch conversion and hardware acceleration support.
  • ✔️ Lifetime License, No Subscriptions: Get a lifetime license with no hidden fees or subscriptions, offering one-time access for 1 PC, compatible with Windows 11, 10.

Capture hangs or times out

Set a bounded timeout, identify long-lived requests, and use a targeted readiness selector instead of waiting forever for network idle. Retry transient navigation failures, but log the final URL and browser error so recurring failures can be diagnosed.

Private content should not leave your network

Use a local Playwright or Chrome workflow for confidential HTML. A hosted API is appropriate only after reviewing its current security, privacy, and retention terms and confirming that your data policy permits the transfer.

Operational checklist

  • Choose viewport, full-page, or element scope before writing code.
  • Set viewport dimensions and device scale deliberately.
  • Wait for an application-specific ready signal.
  • Use PNG for transparency or lossless text; set JPEG quality when JPEG is required.
  • Check the output file’s actual format and dimensions.
  • Bound navigation and screenshot timeouts and record failures.
  • Test pages with consent banners, lazy images, authentication, and responsive layouts.
  • For hosted capture, review privacy terms and monitor billed-versus-failed responses.

Frequently Asked Questions

Can I convert HTML to an image without opening a visible browser window?

Yes. Chrome Headless, Playwright, Browsershot, wkhtmltoimage, and ScreenshotNeo all render without a normal visible browser window.

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

Does converting HTML preserve links and selectable text?

No. JPG, PNG, and WebP are raster images. Use HTML or PDF when links, text selection, or accessibility must remain available.

Why does my screenshot differ from what I see in my browser?

Viewport size, device scale, fonts, authentication, geolocation, JavaScript timing, cookies, and responsive CSS can all change the rendered result.

Can a screenshot include content loaded after the initial page response?

Yes, if the capture workflow waits for that content or triggers its loading behavior before taking the screenshot.

Quick Recap

Bestseller No. 1
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Doxillion Free Document Converter – Converts DOCX, DOC, PDF, WPS and Many More Files Quickly [Download]
Convert over 50 document file formats.; Preview your files from Doxillion before converting them.
Bestseller No. 2
AVCHD Video Converter: Edit and Convert Files from over 50 Formats into any Video or Audio Format - Great Program for Video Cutting
AVCHD Video Converter: Edit and Convert Files from over 50 Formats into any Video or Audio Format - Great Program for Video Cutting
For Windows 11, 10, Windows 8, Windows 7, Windows Vista, Windows XP (SP2 or later)
$24.99
Bestseller No. 3
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
PDF Converter Ultimate - Convert PDF files into Word, Excel, PowerPoint and others - PDF converter software with OCR recognition compatible with Windows 11 / 10 / 8.1 / 8 / 7
Convert your PDF files into Word, Excel & Co. the easy way; Convert scanned documents thanks to our new 2022 OCR technology
$29.99
Bestseller No. 4
Video Converter Software compatible with Windows 11, 10, 8 and 7 – Easily convert video and audio files even in HD, 4K and 3D – Edit and improve your videos
Video Converter Software compatible with Windows 11, 10, 8 and 7 – Easily convert video and audio files even in HD, 4K and 3D – Edit and improve your videos
Easy and fast conversion without a loss of quality; Support of all the common video and audio formats
$24.99

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.