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

The best Linux method depends on what you are converting. Use headless Chrome or Chromium for a one-off URL, Playwright when you need repeatable automation and precise screenshot settings, and wkhtmltoimage for a short command that converts a local HTML file. All three render HTML rather than merely renaming a file, so JavaScript, stylesheets, fonts, images, viewport size and local-file permissions affect the result.

This guide gives working patterns for each route, explains the options that materially change output, and shows how to diagnose blank, incomplete or unexpectedly scaled PNGs.

Choose a conversion route

Need Use Why
One direct URL from a shell Chrome/Chromium headless The headless command-line interface has a --screenshot option and a window-size setting.
Repeatable scripts, waits and browser automation Playwright The Page API navigates to a page and saves a PNG, with CSS-pixel and device-pixel scale choices.
A simple local HTML-to-image command wkhtmltoimage Ubuntu’s Jammy manual documents a direct input-file/output-file invocation and local-file controls.

These tools are not guaranteed to render every page identically. If pixel fidelity matters, compare the result with the browser and page behavior you actually need to reproduce.

Method 1: Playwright for a scripted PNG

Playwright is the most flexible local option when a conversion is part of a build, test, report or batch job. Its screenshot API infers PNG from a .png path. The example below runs headlessly, waits for navigation to finish, and writes the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Lenovo Business Laptop - Linux Mint (Cinnamon) - Intel i5-1335U, 16GB RAM, 256GB SSD, 15.6" FHD 1920x1080 Display, Full Keyboard, Fast Charging
  • Intel Core i5-1335U Processor (12M Cache, 12 Threads, up to 4.6 GHz) - 256GB Solid State Drive - 16GB DDR4 SDRAM
  • 15.6" FHD (1920x1080) Non-Touch Anti-Glare Display - Intel UHD 620 Integrated Graphics - Stereo Speakers
  • 720p HD Webcam with Privacy Shutter. Integrated Microphone - Intel Dual Band Wireless-AC (2x2) 8265, Bluetooth Version 4.2
  • I/O Ports: 2x USB 3.0, 1x USB 3.1 Type-C 3.1, Headphone/Mic Combo Port, 4-in-1 Card Reader, HDMI, Kensington Mini-Lock Slot
  • Linux Mint (Cinnamon) 64-Bit - Keyboard with Full NumberPad - Fast Charging

Install the browser and dependencies

Install the Playwright package using your JavaScript package manager, then install the browser binaries required by your Linux environment. Playwright’s browser documentation also describes a headless-only installation using:

npx playwright install --with-deps --only-shell

Browser downloads occupy hundreds of megabytes in the operating-system cache by default. Check available disk space and the current Playwright installation requirements for your distribution before provisioning a build agent.

Capture a URL

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

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'page.png' });
  await browser.close();
})();

Save this as capture.js and run it with Node.js. Replace the URL and output path as needed. A relative path is resolved from the directory in which you start Node.

Control dimensions and scale

Set the viewport when the page must match a known layout:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const page = await browser.newPage({
  viewport: { width: 1440, height: 900 }
});

Playwright offers two scale behaviors. scale: 'css' produces one output pixel per CSS pixel. scale: 'device' uses device pixels and can create a larger image on a high-density display. Choose CSS scale for predictable pixel dimensions in pipelines; choose device scale when you need a retina-like asset.

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

fullPage: true captures the complete scrollable page instead of only the viewport. It can create a very tall PNG, so check memory and downstream image limits for long documents.

Wait for content before capturing

A navigation response does not necessarily mean that client-side content, fonts or lazy images are ready. In a script, wait for a selector that proves the page is ready, or add a deliberate delay only when the page has no better readiness signal:

Rank #2
HP 17 Business Laptop - Linux Mint Cinnamon - Intel Quad-Core i5-10210U, 32GB RAM, 1TB PCIe NVMe SSD + 1TB Storage HDD, 17.3" Inch HD+ (1600x900) Display
  • Intel Core i5-10210U (up to 4.2GHz) - 1TB PCIe NVMe + 1TB HDD - 32GB DDR4 SDRAM
  • 17.3" HD+ (1600x900) Display, Intel UHD Graphics 620
  • Built in HD 720p Webcam with Microphone - Bluetooth Version4.2
  • I/O Ports: 2x USB 3.1 (Data Only), 1x USB 2.0, 1x HDMI, 1x Headphone/Microphone Combo Jack
  • Linux Mint Cinnamon 64-Bit - 6-Row Keyboard w/ Full Numberpad
await page.goto('https://example.com', { waitUntil: 'networkidle' });
await page.screenshot({ path: 'page.png' });

For application pages, a selector-based wait is usually more meaningful than a fixed sleep. If the page never reaches the selected state, Playwright will fail rather than silently producing an incomplete image; raise or lower the timeout to match the site.

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

Capture a local HTML file

Navigate to an absolute file URL when the HTML is on disk. Keep the document, CSS, images and fonts in locations the browser process can read, and use absolute paths when relative references are ambiguous:

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

(async () => {
  const browser = await chromium.launch();
  const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
  await page.goto('file://' + path.resolve('index.html'));
  await page.screenshot({ path: 'index.png', fullPage: true, scale: 'css' });
  await browser.close();
})();

Local pages that fetch network resources can still be affected by connectivity, CORS policy and the timing of those requests. A missing image or stylesheet is a page dependency problem, not a PNG-format problem.

Method 2: Chrome or Chromium headless from the command line

For a direct URL and no scripting, use the installed Chrome/Chromium executable’s headless interface. Chrome documents that the --screenshot flag saves screenshot.png in the current working directory.

google-chrome --headless --disable-gpu --screenshot https://example.com

The executable may instead be named chromium, chromium-browser or another distribution-specific name. Confirm the name and supported flags with the build installed on your Linux system. Set the viewport explicitly when layout depends on width:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
google-chrome --headless --disable-gpu --window-size=1440,900 --screenshot=page.png https://example.com

Use an output filename ending in .png when you want to make the result unambiguous. If the command reports an unknown flag, consult the installed build’s headless command-line reference rather than copying syntax from a different release.

Local files with Chrome

Pass a file URL, for example:

google-chrome --headless --disable-gpu --screenshot=local.png file:///home/user/site/index.html

Local resource loading can be restricted by browser security settings. Keep related assets accessible to the browser process and investigate the browser’s error output if CSS or images disappear.

Rank #3
Panasonic Toughbook CF-31 MK5 Rugged Laptop, 13.1in i5, 8GB 256GB (Renewed)
  • [ULTRA-RUGGED DESIGN] MIL-STD-810G and IP65 certified. Built to survive 6-foot drops, heavy rain, and extreme vibrations. Features a magnesium alloy chassis with an integrated carry handle for maximum portability
  • [4G LTE - WORK ANYWHERE] Integrated 4G LTE Multi-Carrier Mobile Broadband. Stay connected to the internet in remote areas or on the road without relying on Wi-Fi or phone hotspots. True mobile freedom for field professionals
  • [1200-NIT SUNLIGHT READABLE] 13.1" XGA Touchscreen with CircuLumin technology. At 1200 nits, it is nearly 4x brighter than a standard laptop, ensuring perfect visibility under direct, intense sunlight
  • [LINUX UBUNTU PRE-INSTALLED] Fast, secure, and bloatware-free. Optimized for developers, network engineers, and diagnostic software that thrives in a stable, open-source environment
  • [LEGACY SERIAL PORT] Features a native RS-232 Serial Port, HDMI, and USB 3.0. Essential for connecting directly to industrial machinery, CNCs, and automotive diagnostic tools without unreliable adapter

Method 3: wkhtmltoimage for a concise local conversion

Ubuntu’s Jammy manual describes the command as:

wkhtmltoimage [OPTIONS]... <input file> <output file>

For a local document, the basic conversion is:

wkhtmltoimage index.html page.png

The cited Jammy package is version 0.12.6-2; package availability and behavior can differ on another distribution or release. Check your distribution’s current package documentation before installing or standardizing this tool.

Allow dependent local files

The Jammy manual warns that access to other local files is not allowed unless explicitly permitted. If your HTML references a local stylesheet, image or font, allow the directory containing those assets:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wkhtmltoimage --allow /home/user/site /home/user/site/index.html /home/user/site/page.png

Use the narrowest directory that contains the required resources. Do not broadly expose unrelated parts of the filesystem just to make a conversion succeed.

Make the PNG match the page you intend

Viewport and responsive breakpoints

Responsive CSS changes at viewport breakpoints. Set --window-size in Chrome or viewport in Playwright, and record that choice with the output so a later run is reproducible.

Full page versus visible viewport

A viewport screenshot is bounded by the browser window. A full-page Playwright capture includes the document’s scrollable height and can be substantially larger. Choose the form your consumer expects: a social-card-sized image, a screen-equivalent capture, or a long document.

Fonts, images and lazy content

Fonts may change line wrapping after they load, and lazy images may not exist until they enter an intersection threshold. Wait for a page-specific ready marker, scroll or otherwise trigger the content in your automation, then capture. A fixed delay is only a fallback because network speed varies.

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

Local security and permissions

When a local stylesheet or image is missing, verify the path from the renderer’s point of view and its permissions first. With wkhtmltoimage, remember the explicit --allow requirement. With browser automation, inspect console and network errors instead of assuming the PNG encoder failed.

Rank #4
Lenovo V15 Gen 4 - Business Laptop - AMD Ryzen 5 7430U - 15.6" FHD Display - 8GB RAM - 512GB SSD Storage - Integrated AMD Radeon™ Graphics - Webcam Privacy Shutter - Business Black
  • THE POWER TO STAY PRODUCTIVE – Looking to make your everyday work and home life more manageable without breaking the bank? The Lenovo V15 Gen 4 offers long-term reliability with top-of-the-line features to make you your most productive self.
  • CRUSH YOUR TO-DO LIST – The AMD Ryzen CPU pairs quiet performance and enhanced operating power to crush your high-demand workday. It optimizes performance and allows for seamless multitasking.
  • TRUE-TO-LIFE VISUALS – The 15.6” FHD IPS display is anti-glare with 300 nits brightness to see your best outside or in. Its 88% screen-to-body ratio makes viewing detailed applications like spreadsheets a breeze.
  • SEAMLESS COLLABORATION – Lenovo Smart Appearance enhances your camera effects to protect your privacy and to make you the focus of every video conference. Intelligent noise cancelation minimizes distraction and Dolby Audio provides an elegantly sonorous experience.
  • BUILT TO WITHSTAND – Built for military-grade toughness, the V15 Gen 4 is tested to withstand harsh temperatures, pressure, humidity, vibrations and more. Keep your work safe from the board room to your living room and everywhere in between.

Reliability, performance and cost considerations

  • Startup cost: Playwright launches a browser process, so reuse one browser for many pages instead of launching a new process for every image.
  • Disk: Playwright browser binaries take hundreds of megabytes in the default cache; include that space in containers and CI runners.
  • Memory: Full-page and device-scale screenshots consume more memory than viewport-sized CSS-scale images.
  • Repeatability: Pin the browser/tool version used by a build where possible, set viewport and scale explicitly, and wait for a deterministic readiness condition.
  • Failure accounting: A command can exit successfully while the page itself is incomplete. Check that the output exists, has a nonzero size, and visually contains expected content.

Common failures and fixes

“Command not found”

The executable is not installed or has a different name. Locate the installed Chrome/Chromium or wkhtmltoimage binary and use the distribution’s package instructions; do not assume Ubuntu’s name applies everywhere.

Playwright cannot launch a browser

Browser binaries or Linux dependencies are missing. Run the documented browser installation, including the headless-only --with-deps --only-shell option where appropriate, then check disk space and permissions.

The PNG is blank or shows a bot-check page

The target may require interaction, authentication or a browser environment that the simple command does not provide. Use Playwright to supply the required state and wait for the real page; a renderer cannot manufacture access that the site denies.

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.

CSS or images are missing from a local file

Check relative paths, file permissions and local-file restrictions. For wkhtmltoimage, add a narrowly scoped --allow directory. For Playwright or Chrome, inspect the resolved file URL and browser errors.

The capture is the wrong size

Set the viewport or window size explicitly and decide whether CSS or device scale is appropriate. Remember that device scale can produce more output pixels than the CSS dimensions.

The page is cut off or content is absent

Use Playwright’s fullPage option for a complete document and wait for the selector, network state or application event that signals content readiness. A screenshot taken immediately after navigation may precede lazy loading.

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

Or skip the browser setup

ScreenshotNeo provides a website screenshot API when you want a PNG without maintaining a local browser installation. One GET request returns a screenshot; the API can also produce JPEG, WebP or PDF. Its cleanup steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets before capture, with each step independently switchable. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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.

See the full parameter reference in the ScreenshotNeo documentation. The same service also offers an MCP server for Claude, Cursor and other MCP clients, with take_screenshot, get_page_info and capture_pdf tools.

Best Value
Lenovo IdeaPad Slim 3 Linux Laptop, 15.6" FHD Touchscreen Laptop, 8-Core AMD Ryzen 7 5825U, 16GB RAM, 512GB SSD, Keypad, SD Card Reader, Stylus Pen + External Portable SSD + USB Hub, Linux Ubuntu OS
  • Powerful Linux Laptop: This IdeaPad Slim 3 Laptop comes pre-installed with Ubuntu Linux, offering fast performance, robust security, and a clean, user-friendly experience. Enjoy full customization, seamless hardware compatibility, and access to thousands of open-source apps. Whether you're working, creating, or coding, it's built to keep up with everything you do.
  • A Multitasking Master: The latest AMD Ryzen 7 5825U processor (up to 4.5 GHz) delivers powerful performance with 8 cores and 16 threads for smooth multitasking. Integrated AMD Radeon Graphics provide crisp visuals for streaming, browsing, photo editing, and casual gaming. With smart machine intelligence, it adapts to your needs for a fast, responsive experience.
  • 15.6" Full HD Display: The IdeaPad Slim 3 boasts an 88% screen-to-body ratio for a floating, edge-to-edge visual experience. TÜV Low Blue Light certification reduces eye strain, making it perfect for long work or study sessions.
  • Military-Grade Durability: The smart IdeaPad Slim 3 combines portability and durability, letting you work, study, and play on the go. With a profile 10% slimmer than the previous generation, it's lightweight yet military-grade rugged, ready for anything, anywhere.
  • Versatile Connectivity: Enjoy the security of a built-in webcam with a privacy shutter. Connect effortlessly with multiple ports: 2x USB A, 1x USB C, 1x HDMI, 1x SD Card Reader, 1x Headphone/Microphone combo. Bundle comes with Stylus Pen, 256GB Portable SSD and 5-in-1 Docking Station.

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)
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}`);

The API supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper and page controls, HTML/CSS-to-image, custom JavaScript and CSS, clicks, selector waits, delays, network-idle waits, ad/tracker/request blocking, custom headers and cookies, user agents and authorization, timezone and 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 and an OpenAPI specification. Parameter names used by other screenshot APIs are accepted to ease migration.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. Create a free ScreenshotNeo account to start.

Frequently Asked Questions

Which method should I use for a CI pipeline?

Use Playwright when the pipeline needs waits, viewport control, full-page output or other browser actions. Reuse a browser process across captures and make the readiness condition explicit.

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

Can these tools convert an HTML string that is not saved as a file?

The documented examples take a URL or an input file. Save the string as an HTML file, serve it from a local HTTP endpoint, or use a renderer/API that explicitly accepts HTML input.

Why does a high-density screenshot have different dimensions than my CSS layout?

Device-pixel scale multiplies output pixels for high-density rendering. Select CSS scale when the PNG should retain one pixel per CSS pixel.

Is wkhtmltoimage’s Jammy package version current for every Linux distribution?

No. The cited Ubuntu Jammy manual records version 0.12.6-2; other distributions may package a different version or omit it.

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.