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

To convert a webpage or HTML file to PNG, render it in Chrome or Chromium Headless; to convert a PDF, rasterize its pages with Poppler or Python’s pdf2image. HTML conversion captures the browser-rendered page, while PDF conversion normally creates a separate PNG for each page. The right settings depend on whether you need a predictable viewport, a particular page range, or more pixels for OCR or print.

Choose the right converter

Input and goal Recommended method Useful controls Trade-off
Live webpage or local HTML, one screenshot Chrome or Chromium Headless Viewport, timeout, virtual-time budget Captures a browser viewport; a long page may need a full-page automation workflow.
HTML capture in an application or at scale Puppeteer with Headless Chrome Navigation wait condition, viewport, screenshot options Requires Node.js and browser automation setup.
PDF to one PNG per page Poppler’s pdftoppm/pdftocairo or Python pdf2image DPI, page range, crop box, transparency, grayscale Higher DPI means more pixels, memory use, and output size.
Resize, crop, or optimize an existing image ImageMagick Resize, colorspace, crop, compression ImageMagick processes images; it is not an HTML browser renderer.

For a straightforward one-off HTML capture, start with Chrome’s command-line screenshot option. For a PDF, use Poppler directly or call it through pdf2image. Use ImageMagick only after rendering if you need to modify the resulting PNG.

Convert a webpage or HTML file with Chrome Headless

Capture a live URL

With Chrome or Chromium installed and available as chrome on your command line, run:

chrome --headless --screenshot https://example.com/

Chrome saves screenshot.png in the current working directory. That is a browser screenshot, not a download of the page’s original HTML or a screenshot of every vertical section. The Chrome for Developers documentation describes --screenshot as capturing the target page and saving it as screenshot.png.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

Set a repeatable viewport

When you need a known layout, specify the viewport width and height in pixels:

chrome --headless --screenshot --window-size=1280,1696 https://example.com/

A fixed viewport makes comparisons more consistent because responsive pages can rearrange content at different widths. It does not guarantee identical results across machines: fonts, browser versions, loaded assets, and page state can still change the rendering.

Wait for late content

For content that appears shortly after navigation, add a bounded wait:

chrome --headless --screenshot --timeout=5000 https://example.com/

The timeout is in milliseconds. Chrome’s documentation says it sets a maximum wait before capture even if the page is still loading; it is a ceiling, not a promise that every image, font, or application request will finish within that time. For JavaScript timers or animation, --virtual-time-budget can advance virtual time before capture. Choose and record the budget to make the intended capture state reproducible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Render local HTML

Use an absolute file URL so Chrome can locate the document:

chrome --headless --screenshot file:///absolute/path/page.html

Check that relative CSS, fonts, images, and scripts resolve from that file location. A PNG with missing styling or images may indicate a path or network-access problem rather than a screenshot failure. For confidential local documents, a local browser avoids uploading the file to an unknown online converter.

Capture HTML programmatically with Puppeteer

Puppeteer controls Headless Chrome from Node.js. This example sets a viewport, waits for a network-idle navigation condition, saves a PNG, and closes the browser:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1280, height: 1696 });
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'page.png' });
  } finally {
    await browser.close();
  }
})();

Install Puppeteer in your Node.js project before running the script. The networkidle2 condition is one possible navigation wait condition, not proof that all delayed or interaction-triggered content is present. If the target page continues to load or updates after navigation, wait for a relevant selector or other known completion signal before capturing. Puppeteer offers screenshot options for different capture needs; consult its version-specific documentation when changing those options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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 PDF into PNG pages

Use Poppler from the command line

Install Poppler for your operating system, then run:

pdftoppm -png -r 200 input.pdf page

This asks pdftoppm to render the PDF as PNG at 200 DPI, using page as the output prefix. It produces one image per page; exact filename conventions can vary with tool version and options. To avoid processing an entire large document, use the tool’s page-selection options to render only the pages you need.

Use Python and pdf2image

pdf2image is a Python wrapper for Poppler utilities and returns a Pillow image for each requested page. Install the Python package and Poppler, then run:

from pdf2image import convert_from_path

pages = convert_from_path(
    "input.pdf",
    dpi=200,
    first_page=1,
    last_page=3,
    fmt="png",
)

for index, image in enumerate(pages, start=1):
    image.save(f"page-{index}.png")

This example converts only pages 1 through 3. The pdf2image documentation lists a default dpi of 200; that is a default, not a universal recommendation for quality. Its controls include page range, output folder, transparency, grayscale, crop-box selection, single-file output, and timeout. It can also return paths instead of keeping all images loaded in memory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Choose DPI and manage large files

DPI determines how many pixels are used to represent the PDF page. A lower setting may be sufficient for a screen preview; OCR or print-oriented work generally needs more pixels. There is no universal DPI that guarantees a particular quality: the page’s dimensions, content, downstream use, and OCR process matter.

  • Record the DPI and page range in the command or script so another run can reproduce them.
  • Raise DPI at render time if text is too soft; enlarging a low-resolution PNG afterward cannot restore detail that was never rendered.
  • If outputs are too large, lower DPI, select fewer pages, use grayscale when color is unnecessary, or resize after rendering.
  • For large PDFs, process page ranges or return output paths rather than loading every page’s image into memory at once.
  • Use transparency only when a later workflow needs it; an opaque background is generally easier to view and compress.

Handle protected or malformed PDFs

pdf2image exposes password parameters for password-protected PDFs and controls for timeout and strict syntax-error handling. Supply the appropriate password when you have authorization to open the document. A malformed, font-heavy, or image-heavy PDF may render differently across tools; test those files in the environment where the conversion will run rather than assuming every PDF will produce identical output.

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

Use ImageMagick after conversion

ImageMagick can convert and process raster images. Its official example is:

magick rose.jpg rose.png

After rendering a PDF page, for example, resize it for web delivery with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.
magick page-1.png -resize 1600x page-1-web.png

You can also use ImageMagick for cropping, colorspace changes, appending, or compression. It does not replace Chrome as the layout engine for HTML: first render the web page in a browser, then pass its PNG through an image-processing step if needed.

Or skip the browser setup

For a live webpage, ScreenshotNeo can return a PNG, JPEG, WebP, or PDF from one GET request. This example saves a WebP capture:

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. Its clean-shot process accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. See ScreenshotNeo for the service and sign up for 1,000 free screenshots a month with no card.

Troubleshoot common conversion problems

The HTML screenshot is blank or incomplete

  • Cause: The page has not finished loading, or its content is added after navigation. Fix: Set a bounded Chrome timeout or, in Puppeteer, wait for the selector or page state that indicates the content is ready.
  • Cause: Scripts, images, fonts, or stylesheets cannot be reached. Fix: Check network access and local-file paths, and inspect the page in a regular browser for missing assets.
  • Cause: The content requires a click or other interaction. Fix: Use browser automation to perform the required interaction before taking the screenshot.

The layout differs between captures

  • Cause: The viewport, browser environment, font availability, or page state differs. Fix: Fix the viewport dimensions, use the same browser setup, and wait for fonts and dynamic content before capture.
  • Cause: An animation or timer is at a different point. Fix: Use a documented virtual-time budget or wait for a known stable state.

The PDF conversion is slow or creates huge files

  • Cause: High DPI multiplies pixel count, memory use, and output size. Fix: Lower DPI, restrict the page range, or render in batches.
  • Cause: Every page is held in memory. Fix: Process smaller ranges or use output paths where supported.

A PDF fails to render or text looks wrong

  • Cause: The file may be password-protected, malformed, or dependent on fonts that are unavailable. Fix: Provide an authorized password, check the PDF in a viewer, and verify required fonts and Poppler installation.
  • Cause: The render resolution is too low for the intended use. Fix: Increase DPI and rerun the conversion rather than enlarging the existing PNG.

Questions readers ask

Can I convert every page of a PDF to PNG?

Yes. Omit the page-range restriction to render the full document; the result is ordinarily one PNG per page. For large files, convert in ranges to control memory use.

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

What DPI should I use for PDF to PNG?

Choose based on the intended use and inspect the output. Lower resolution may suit previews; OCR and print use usually call for more pixels. The documented pdf2image default is 200 DPI, not a universal quality target.

Can ImageMagick convert HTML directly to PNG?

Use a browser such as Chrome to render HTML first. ImageMagick is for processing raster images, not reproducing browser layout.

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.