Use Bash to launch a browser renderer; Bash itself does not render HTML. For a repeatable screenshot of a modern website, the most controllable route is Playwright with a small Node.js script. For a quick URL capture, Chrome Headless can do it with one command. For a local HTML file, wkhtmltoimage offers a direct input-to-output command, but check its rendering against your page.
Choose a renderer for the job
The right command depends on whether you have a URL or a local file, need a viewport or full-page image, and whether the page relies on modern JavaScript. Bash orchestrates the work; the browser or converter determines what gets rendered. Installed binaries, fonts, network access, and page behavior can all affect the output.
| Option | Best fit | What to know |
|---|---|---|
| Playwright API | Repeatable scripts and configurable full-page captures | Write a short Node.js script and install the browser for the environment. |
| Playwright CLI | Command-oriented or interactive capture workflows | Supports output path, image type, full-page capture, and high-resolution capture. |
| Chrome Headless | A quick screenshot of a URL | One command can capture a viewport; use the documented window-size option to set the window dimensions. |
| wkhtmltoimage | A direct local HTML input-to-image command | Check the installed binary’s output on your target page, especially if it uses modern JavaScript. |
For a page that must execute scripts and reproduce a rendered website, start with Playwright or Chrome Headless. Choose Playwright when you need API-level control such as full-page capture and image settings. Choose Chrome for a one-off URL capture. Use wkhtmltoimage when its rendering is suitable for your specific HTML.
Capture a page with Playwright from Bash
This method uses Playwright’s Node.js API to open a page and save a full-page screenshot. It is a useful starting point for scheduled or repeated capture jobs because you can keep browser behavior in a script and invoke it from Bash.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Install Playwright and its browser
Install Playwright in a Node.js project, then install Chromium and any required operating-system dependencies using the commands in the Playwright browser installation documentation. The browser must be installed in the environment where the script runs; installing the JavaScript package alone does not guarantee that a usable browser binary is present.
Create the capture script
Save this as capture.cjs in the project where Playwright is installed:
const { chromium } = require('playwright');
(async () => {
const url = process.argv[2];
const outputPath = process.argv[3] || 'page.png';
if (!url) {
console.error('Usage: node capture.cjs <url> [output-file]');
process.exitCode = 2;
return;
}
const browser = await chromium.launch();
try {
const page = await browser.newPage({
viewport: { width: 1280, height: 900 }
});
await page.goto(url, { waitUntil: 'networkidle' });
await page.screenshot({ path: outputPath, fullPage: true });
console.log(`Saved ${outputPath}`);
} finally {
await browser.close();
}
})();
Run it from Bash with a URL and optional output path:
node capture.cjs 'https://example.com' 'page.png'
The script opens Chromium at a 1280-by-900 viewport and asks Playwright to capture the full page. The documented screenshot API supports a file path and full-page capture; other API options cover image type, quality, and scale. Check the Playwright screenshot API documentation for the supported settings.
networkidle waits for network activity to settle, but some sites keep requests open indefinitely or load content later. If the command stalls or captures too early, use a wait condition appropriate to the page, such as waiting for a known selector or a deliberate delay. Do not assume that one wait strategy fits every site.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Use the Playwright CLI instead
For a command-oriented workflow, Playwright also documents a CLI screenshot command. Its options include an output filename, image type, full-page capture, and high-resolution capture. Consult the Playwright CLI documentation for the current command syntax and available options, and install the browser required by your environment.
Take a quick screenshot with Chrome Headless
If Chrome is installed and available as chrome in your shell, this command captures a URL to screenshot.png in the current working directory:
chrome --headless --screenshot --window-size=1280,900 https://example.com
Chrome’s Headless documentation describes --screenshot and its use with --window-size. The window-size setting controls the capture window dimensions in this example; this is a quick viewport capture, not a full-page capture workflow. See the Chrome Headless documentation for details.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchIf the executable is named differently on your system, substitute the installed binary’s name. The command also depends on Chrome being installed and able to run in the environment; container and server setups may require additional operating-system configuration.
Inspect the rendered DOM when debugging
Chrome’s --dump-dom can help diagnose differences between source markup and what the page renders. It is not the same as downloading the original HTML: Chrome parses the document, runs scripts that may change the DOM, and then serializes that DOM. Use it when you need to understand script-generated content, not as an image conversion command.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Convert a local HTML file with wkhtmltoimage
For a straightforward local file conversion, use the documented input/output form:
wkhtmltoimage input.html output.png
wkhtmltoimage is described as a tool for converting an HTML page into an image. The command interface is simple, but compatibility with current JavaScript-heavy layouts is not established here. Test the output on the actual page and installed version before relying on it for production captures. The wkhtmltoimage manual documents the command and its options.
Recommended Free Tools
Choose image dimensions, scope, and timing
Decide what should appear in the image before automating captures. A viewport screenshot records the visible browser area; a full-page screenshot aims to include content beyond that initial view. Browser APIs also expose image format and quality settings, while viewport and scale affect the resulting pixel dimensions. The exact controls depend on the renderer you choose.
- URL or local file: Chrome Headless and Playwright are browser routes for rendered pages. The direct
wkhtmltoimage input.html output.pngform suits a local input file. - Viewport or full page: Use viewport dimensions for a fixed-size view; use Playwright’s
fullPageoption when the full document is needed. - JavaScript execution: A browser renderer can execute page scripts. Allow enough time for the content you need to appear, and verify the output.
- Output type and quality: Playwright’s screenshot API documents image settings. Chrome’s simple command above writes a PNG.
- Runtime requirements: Browser binaries, operating-system dependencies, fonts, and network access must be available to the process running the capture.
- One-off or repeated job: Use a short browser command for an occasional capture; use a script when you need repeatability or per-page logic.
Troubleshoot common capture problems
The Playwright script cannot find a browser
Cause: Playwright is installed, but its browser has not been installed for this environment, or the runtime cannot access the browser binary. Fix: Follow the Playwright browser installation instructions for Chromium and the operating-system dependencies, then run the script in the same environment.
The page never finishes loading
Cause: A site may maintain background network connections, making networkidle a poor fit. Fix: Wait for a page-specific selector or use another suitable wait condition. If the page loads content after navigation, add a deliberate, bounded wait and confirm the resulting image.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
The screenshot is blank or missing expected content
Cause: The page may need more time, a script may have failed, or the renderer may not handle the page as expected. Fix: Inspect the page in the same browser environment, wait for a meaningful element, and compare the result with the page’s rendered DOM. If using wkhtmltoimage, verify compatibility against the target rather than assuming modern layouts render correctly.
The output dimensions are wrong
Cause: Browser viewport size, full-page behavior, and image scale are separate choices. Fix: Set the viewport explicitly in Playwright or use Chrome’s --window-size, then check whether you intended a viewport or full-page image.
The command works locally but fails in automation
Cause: The job environment may lack the browser binary, required system dependencies, fonts, or network access available on your workstation. Fix: Install the browser and dependencies in the execution environment and test the exact command there. Keep credentials and any sensitive page content out of shared build artifacts unless their access controls are appropriate.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
For a hosted screenshot call, ScreenshotNeo accepts a URL and returns an image or PDF. Its capture flow accepts cookie/consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the response identifying the page verdict and billing status in headers. It also provides an MCP server with screenshot, page-info, and PDF tools for AI agents.
Here is the one-call cURL example; replace the URL with the page you want to capture and provide your API key:
Free tools Windows power users keep installed
One-click scans. No signup required.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options and response details. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Learn about ScreenshotNeo or sign up for the free plan.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Keep captures reliable and safe
A screenshot is a rendering result, not a guarantee that the page has finished every application-specific task. Confirm that important content is present, use a wait condition matched to the page, and keep the capture environment consistent when output repeatability matters. The renderer, browser version, fonts, network, and page behavior all influence what appears.
Treat screenshots of authenticated pages as potentially sensitive artifacts. Avoid saving them to shared build outputs without considering who can access them and whether they expose account data, personal information, or secrets.
Frequently Asked Questions
Does Bash convert HTML to an image by itself?
No. Bash launches a browser or converter; that program renders the HTML and writes the image.
Can I capture a local HTML file with Chrome Headless?
The documented Chrome example here is for a URL. For a direct local-file input/output command, wkhtmltoimage documents `wkhtmltoimage input.html output.png`.
Is `–dump-dom` a way to save the original HTML?
No. Chrome executes scripts before serializing the resulting DOM, so it can differ from the original response markup.
Quick Recap
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.

