URL to PNG with Python

Screenshot webpages as PNG with Python

No browser management required

Capture public webpages from Python with the html-css-to-image PyPI package without installing Chrome, running Playwright or Selenium, or maintaining screenshot storage and delivery.

  • No browser processes to maintain
  • Full-page and selector controls included
  • Complete Python request below
Real URL screenshot API requests followed by their rendered webpage images.
Request
POST https://hcti.io/v1/image
{
"url": "https://google.com",
"format": "png",
"viewport_height": 480,
"viewport_width": 640
}
https://google.com
Screenshot of Google in a small viewport

Python workflow

Test the webpage capture before adding it to Python

Choose the URL and browser state here, then use the Python example below instead of rebuilding the screenshot workflow locally.

Loading playground…

Managed screenshots

Skip the fragile parts of native Python screenshot automation

Keep the application code focused on the request and response while HCTI manages Chromium, page loading, render isolation, retries, and hosted output.

No browser runtime to maintain

Keep Python web apps and job workers from carrying a local browser runtime alongside the application environment.

Screenshot controls are already modeled

Set the viewport, full-page mode, selector, timing, color scheme, and browser state as request parameters instead of browser scripts.

A usable image URL immediately

Receive the hosted .png result without building a separate pipeline for temporary files, uploads, storage, and delivery.

URL screenshot API

Send one Python request instead of running a browser

POST the webpage URL, capture settings, and format from Python. HCTI handles the browser lifecycle and returns the generated .png URL.

  • Public webpage URL

    Send the URL to load, including webpages whose final state depends on browser-rendered JavaScript.

  • PNG output

    Set format to png and use the hosted .png URL returned by the API.

  • Viewport and crop controls

    Set viewport dimensions, capture the full page, or crop the result to a CSS selector.

  • Browser environment

    Choose color scheme, timezone, mobile behavior, timing, and other page-loading controls.

POST https://hcti.io/v1/image request example.
Request
POST https://hcti.io/v1/image
{
"url": "https://example.com",
"format": "png",
"viewport_width": 1200,
"viewport_height": 630
}

How it works

From webpage URL to a finished PNG

  1. Send the webpage URL

    Submit a public URL with format set to png and any viewport, selector, or browser settings.

  2. Chromium loads the page

    The API runs the webpage, styles, fonts, images, and JavaScript in a managed browser environment.

  3. Use the .png URL

    Embed the hosted result, download the file, or save it in your own storage and application records.

Example code

Screenshot a webpage as PNG in Python

Copy a complete Python request. Authentication, the webpage URL, viewport settings, output format, and response handling are shown together.

# pip install html-css-to-image
from html_css_to_image import HtmlCssToImageClient, CreateUrlImageRequest

request = CreateUrlImageRequest(
    url="https://example.com",
    format="png",
    viewport_height=630,
    viewport_width=1200,
)

with HtmlCssToImageClient.from_env() as client:
    result = client.create_image(request)

if result.success:
    print(result.url)
else:
    print(result.error)

Ready to capture?

Take your first PNG webpage screenshot

Send a public URL to the API and receive a hosted .png image without running browser infrastructure.