October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Chrome Headless

How to Convert an HTTPS URL to a PNG Image

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

To turn an HTTPS URL into a PNG, open the page in a browser and capture its rendered pixels. The URL itself is not an image, so changing its extension will not convert it. For a repeatable local workflow, Playwright can navigate to the page and save a PNG; for a quick command-line capture, Chrome Headless has a screenshot option.

What “convert a URL to PNG” means

A URL identifies a web resource. To make a PNG of a webpage, a browser must request the page, render its HTML, CSS, fonts, and images, then save a screenshot of the rendered result. This captures what the browser displays—not the source code, and not necessarily every item on the page.

The capture can show only the current viewport, the entire scrollable page, or one selected element. Those choices affect the image’s contents and dimensions. If the page requires a sign-in, has delayed content, or blocks automated browsers, the result may differ from what you see in your own browser.

Choose a capture method

Method Best for What it provides
Playwright Page API Scripts and repeatable workflows Browser navigation, configurable screenshots, and a saved file or image buffer
Playwright CLI Terminal captures using documented screenshot commands Viewport, full-page, or element screenshots with options for output name and scale
Chrome Headless A quick one-off command when Chrome is installed A screenshot from a URL, with a window size you can specify
ScreenshotNeo One-call captures, recurring jobs, or agent workflows A screenshot API and MCP server; see the section below for an example

For a locally controlled script, the Playwright API is a flexible starting point. Use the CLI or Chrome Headless when you want a terminal command rather than application code.

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

Save a PNG with Playwright’s Page API

Playwright’s Page API shows the basic sequence: launch a browser, create a page, navigate to a URL, and call page.screenshot() with a PNG filename. The following complete Node.js example saves a viewport screenshot. See the Playwright Page API documentation for screenshot options.

Install and run

  1. Create a project and install Playwright:

    npm init -y
    npm install playwright
    npx playwright install chromium

  2. Save this as screenshot.mjs:

    import { chromium } from 'playwright';

    const url = process.argv[2] ?? 'https://example.com';
    const browser = await chromium.launch({ headless: true });
    try {
      const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
      await page.goto(url, { waitUntil: 'load', timeout: 60000 });
      await page.screenshot({ path: 'screenshot.png', type: 'png' });
      console.log('Saved screenshot.png');
    } finally {
      await browser.close();
    }

  3. Run it with a URL:

    node screenshot.mjs https://example.com

The example uses a 1280 by 800 CSS-pixel viewport. The saved PNG shows the visible viewport, not automatically the entire page. Playwright infers the output format from the filename extension when you provide a path; a .png path saves PNG. The API also supports JPEG and WebP.

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

Capture the full page or one element

For a full-page image, use the screenshot option fullPage: true:

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

To capture a particular component, locate it and screenshot that element:

await page.locator('.your-selector').screenshot({ path: 'element.png' });

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

Replace .your-selector with a selector that matches the element on the target page. Full-page images can be very tall, and an element capture can fail if the selector does not match or the element is not visible.

Use a buffer instead of writing a file

If another part of your program needs to process or send the image, capture a buffer rather than saving directly:

const png = await page.screenshot({ type: 'png' });

png contains the PNG bytes. You can pass those bytes to a storage client, an HTTP request, or an image-processing step. A path is simpler when the desired outcome is a local file.

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

Capture with the Playwright CLI

The Playwright CLI screenshot commands support viewport captures, full-page screenshots, element captures, custom output filenames, and explicit PNG selection. The CLI documentation says PNG is the default when no explicit type or filename extension overrides it. Consult the Playwright CLI screenshot documentation for exact command syntax and available options for your installed CLI.

Choose full-page capture when content below the fold must appear in one image, or an element capture when you need only a chart, card, or form. The CLI’s --hires option captures device pixels rather than CSS pixels, which can increase the output dimensions on a high-density display. Use it when resolution matters; omit it when a CSS-pixel-sized image is more useful.

Use Chrome Headless for a one-off capture

Chrome for Developers documents a command-line screenshot flag. A window-size argument sets the browser window dimensions for the capture:

chrome --headless --screenshot --window-size=412,892 https://example.com

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

Run the command using the Chrome executable available on your system; its name or location can vary by operating system and installation. Chrome’s documented example uses --window-size=412,892 before the target URL. The screenshot is a viewport-style capture, so it may not include page content below the visible area. See the Chrome Headless command-line reference for the documented flag and usage details.

Choose viewport, full-page, element, and scale deliberately

Use a file path when you want a saved artifact. Use an in-memory buffer when the next step in your workflow will transform, upload, or otherwise consume the image.

Or skip the browser setup

ScreenshotNeo provides a one-request screenshot API. This cURL example requests a PNG by saving the response as shot.png; the API’s format option is set to PNG:

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.

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

Replace YOUR_API_KEY with your key and the example URL with the page you want to capture. See the ScreenshotNeo documentation for API details and options.

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with response headers indicating the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. Sign up for free and try 1,000 screenshots a month with no card.

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

Troubleshooting common capture problems

The output is not a PNG

For Playwright’s API, use a filename ending in .png or explicitly request type: 'png' when capturing a buffer. For other tools, check the output-format option and the extension you specified. Renaming a JPEG or WebP file to .png does not convert its image data.

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

The screenshot shows a blank page or incomplete content

Navigation completing does not guarantee that every image, font, or client-rendered component has finished loading. Inspect the page in a normal browser first. If a specific element is the issue, wait for that selector before capture, or use an appropriate wait condition for the site. Avoid an arbitrary long delay unless the page genuinely needs time; it slows every run without guaranteeing that content is ready.

Best Value
Sale
The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • The Microsoft Office 365 Bible: The Most Updated and Complete Guide to Excel, Word, PowerPoint, Outlook, OneNote, OneDrive, Teams, Access, and Publisher from Beginners to Advanced
  • ABIS BOOK

The page is cut off

A viewport screenshot contains only the visible browser area. Use Playwright’s full-page capture option or the CLI’s full-page mode if the entire scrollable document is required. For Chrome Headless, the documented screenshot example is sized through the window-size option; consult Chrome’s reference for additional supported behavior.

The selected element cannot be captured

Check that the selector matches an element on the page and that the element is visible. If the page renders it later, wait for it to appear before taking the screenshot. If you need the whole page instead, remove the element-specific capture and use a page screenshot.

The local command cannot find Chrome or Playwright’s browser

Chrome Headless requires a Chrome executable available to the command. Playwright requires its browser installation as well as the package; after installing Playwright, run npx playwright install chromium for the example above. If your system uses a different executable name or installation path, use the path appropriate to that environment.

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

Automate responsibly and manage the output

Repeated captures cost time and resources, especially for full-page images or device-pixel output. For a batch workflow, control concurrency rather than launching a large number of browser pages at once. Save stable filenames or include a timestamp when each run should be retained, and verify that the saved file opens as a PNG before passing it downstream.

Only capture pages you are authorized to access. A screenshot may include personal or confidential information visible to the browser session; treat the resulting file and any buffer sent to another service accordingly. If a hosted browser or screenshot API is involved, check that provider’s current privacy, retention, and usage terms before sending sensitive URLs or content. Cloudflare documents a hosted-browser workflow that navigates to a page and returns screenshot bytes with an image/png content type, but that documentation alone does not establish its pricing, limits, or privacy terms. See Cloudflare Browser Run’s Playwright documentation.

Frequently Asked Questions

Does converting the URL change the webpage?

No. It creates an image of a browser-rendered view at capture time; the page itself is unchanged.

Can I capture a page that requires a login?

Only if the browser session is authorized and has the required authenticated state. The basic examples here do not configure login credentials or session cookies.

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

Can I use the screenshot in another program without saving it first?

Yes. Playwright’s Page API can return screenshot bytes as a buffer, which your application can process or pass to another component.

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.

Leave a Reply

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.