Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk5 min

HTML/CSS to Image API Tutorial: Convert a URL to a PNG

A practical HTML/CSS to Image API tutorial with cURL, Python, and Node.js examples, URL capture options, authentication guidance, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To turn a webpage URL into a PNG with HTML/CSS to Image, send a JSON POST request to https://hcti.io/v1/image using HTTP Basic authentication. Use your API ID as the username and API key as the password, and put a fully qualified public URL in the request body. The response contains a generated image URL you can download or embed. PNG is the default format.

Make a PNG from a URL with cURL

First, create API credentials in the HTML/CSS to Image dashboard. Keep both values on a server or in a local environment variable rather than exposing them in browser-side code.

curl -X POST 'https://hcti.io/v1/image' 
  -u "$HCTI_API_ID:$HCTI_API_KEY" 
  -H 'Content-Type: application/json' 
  -d '{"url":"https://example.com"}'

Replace https://example.com with the public page you are authorized to capture. The service accepts JSON or form data. A successful request returns JSON containing the generated image URL; use that URL to download the PNG or reference it in a page. The generated URL remains available while the account is active, according to the Using the API guide.

Use the API from Python or Node.js

These examples use the same endpoint and credentials. Set the API ID and key in your runtime environment before running the code; do not hard-code real credentials into source that may be committed or shipped to clients.

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

Python

import os
import requests

response = requests.post(
    "https://hcti.io/v1/image",
    auth=(os.environ["HCTI_API_ID"], os.environ["HCTI_API_KEY"]),
    json={"url": "https://example.com"},
    timeout=90,
)
response.raise_for_status()
result = response.json()
print(result["url"])

Install the dependency with python -m pip install requests. The response URL is printed rather than assuming a local filename; request that URL separately if your application needs to save the image file.

Node.js

const id = process.env.HCTI_API_ID;
const key = process.env.HCTI_API_KEY;
const credentials = Buffer.from(`${id}:${key}`).toString('base64');

const response = await fetch('https://hcti.io/v1/image', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${credentials}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ url: 'https://example.com' })
});

if (!response.ok) {
  throw new Error(`Screenshot request failed: ${response.status} ${await response.text()}`);
}

const result = await response.json();
console.log(result.url);

This example uses the built-in fetch available in current Node.js releases. Keep the request on a trusted server because it contains the API credentials.

Rank #2
Sale
Canon PIXMA TS6520 Wireless Color Inkjet Printer, Duplex Printing, Copier/Scanner, 1.42" OLED Display, Compact, White
  • Affordable Versatility - A budget-friendly all-in-one printer perfect for both home users and hybrid workers, offering exceptional value
  • Crisp, Vibrant Prints - Experience impressive print quality for both documents and photos, thanks to its 2-cartridge hybrid ink system that delivers sharp text and vivid colors
  • Effortless Setup & Use - Get started quickly with easy setup for your smartphone or computer, so you can print, scan, and copy without delay
  • Reliable Wireless Connectivity - Enjoy stable and consistent connections with dual-band Wi-Fi (2.4GHz or 5GHz), ensuring smooth printing from anywhere in your home or office
  • Scan & Copy Handling - Utilize the device’s integrated scanner for efficient scanning and copying operations

What the request and response mean

The endpoint uses HTTP Basic authentication: the API ID is the username and the API key is the password. A URL screenshot request must include url or html; they are alternatives, and if both are sent the API guide says url overrides html. Use a complete URL such as https://example.com/path, not a relative path. The API guide and example request are at Using the API and Example code.

With no output extension specified, the output is PNG. The API also documents JPG, WebP, and PDF. Its response gives you an image URL rather than raw PNG bytes in the initial POST response. Fetch that URL to save the file, or use it where an image URL is accepted.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon PIXMA TS4320 – Wireless Color Inkjet Printer with Print, Copy, Scan
  • Affordable Versatility - A budget-friendly all-in-one printer perfect for both home users and hybrid workers, offering exceptional value
  • Crisp, Vibrant Prints - Experience impressive print quality for both documents and photos, thanks to its 2-cartridge hybrid ink system that delivers sharp text and vivid colors
  • Effortless Setup & Use - Get started quickly with easy setup for your smartphone or computer, so you can print, scan, and copy without delay
  • Reliable Wireless Connectivity - Enjoy stable and consistent connections with dual-band Wi-Fi (2.4GHz or 5GHz), ensuring smooth printing from anywhere in your home or office
  • Scan & Copy Handling - Utilize the device’s integrated scanner for efficient scanning and copying operations

Useful options for URL captures

The endpoint accepts optional controls for adapting the capture. Confirm the current parameter reference for any setting that may depend on account plan or change over time.

  • css: inject CSS into a URL capture; it is optional and applies when using url.
  • full_screen: capture the full page height rather than only the initial viewport.
  • device_scale: set the rendered pixel ratio.
  • headers: pass custom request headers for supported authorized access, subject to origin restrictions.
  • block_consent_banners: block common consent banners.
  • width and height: set result dimensions; the documented maximum for each is 5000 pixels.
  • dpi: set PDF/image metadata resolution from the documented range of 30–600.

For exact accepted values and parameter behavior, consult the API parameter reference. The documented dimensions and DPI are limits, not a guarantee that every page will render successfully at every combination.

Rank #4
HP OfficeJet Pro 8125e Wireless All-in-One Color Inkjet Printer, Print, scan, Copy, ADF, Duplex Printing Best-for-Home Office, 3 Month Instant Ink Trial Included, AI-Enabled (405T6A)
  • The OfficeJet Pro 8125e is perfect for home offices printing professional-quality color documents like business documents, reports, presentations and flyers. Print speeds up to 10 ppm color, 20 ppm black
  • PERFECTLY FORMATTED PRINTS WITH HP AI – Print web pages and emails with precision—no wasted pages or awkward layouts; HP AI easily removes unwanted content, so your prints are just the way you want
  • UPGRADED FEATURES – Fast color printing, scan, copy, auto 2-sided printing, auto document feeder, and a 225-sheet input tra
  • WIRELESS PRINTING – Stay connected with our most reliable dual-band Wi-Fi, which automatically detects and resolves connection issues
  • 3 MONTHS OF INSTANT INK WITH HP+ ACTIVATION – Subscribe to Instant Ink delivery service to get ink delivered directly to your door before you run out. After 3 months, monthly fee applies unless cancelled.

Capturing pages that require authentication

The API does not perform an interactive login flow. For a page you are authorized to access, the vendor documents supplying a short-lived session cookie or authorization token with the headers parameter. Custom headers are restricted to the requested URL’s origin and any additional origins explicitly allowed by the service.

Avoid sending a long-lived account password or broadly privileged token. Prefer a narrowly scoped, short-lived credential, and keep it out of logs and client-side code. See the vendor’s authenticated-pages guidance and API parameter reference before configuring protected captures.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Brother Work Smart 1360 Wireless Color Inkjet All-in-One Print, Scan, Copy
  • AFFORDABLE ALL-IN-ONE FOR HOME AND HOME OFFICE: Print, copy, and scan on one compact wireless printer designed for everyday home office printing, schoolwork, documents, and reports. Produce beautiful prints for results that stand out.
  • EASY TO USE WITH CLOUD APP CONNECTIONS: Print from and scan to popular Cloud apps(2), including Google Drive, Dropbox, Box, OneDrive, and more from the simple-to-use 1.8” color display on your printer.
  • FULL-SIZE FEATURES IN A COMPACT DESIGN: This printer includes automatic duplex (2-sided) printing, a 20-sheet single-sided Automatic Document Feeder (ADF)(3), and a 150-sheet paper tray(3). Engineered to print at fast speeds of up to 16 pages per minute (ppm) in black and up to 9 ppm in color(4).
  • MULTIPLE CONNECTION OPTIONS: Connect your way. Interface with your printer on your wireless network or via USB.
  • MOBILE PRINTING MADE EASY: Go mobile with the Brother Mobile Connect app(5) that delivers easy onscreen menu navigation for printing, copying, scanning, and device management from your mobile device. Monitor your ink usage with Page Gauge to help ensure you don’t run out(6).
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to use a signed GET image URL

The standard POST flow is usually the clearest choice for a backend job: authenticate the request with Basic auth, submit the URL, and receive a generated image URL. The alternative documented signed GET endpoint creates and returns an image on demand, which can suit cases that need a browser-ready image URL.

Signed URLs require an HMAC SHA-256 token calculated from the exact encoded query string using the API key. Parameter order, encoding, and whitespace affect the signature, so use an official client helper where possible. Generate signatures only on the server. Anyone who receives a completed signed URL can request the image it authorizes. Details are in the signed image URL guide.

Common errors and fixes

  • Authentication fails: verify that the API ID is the Basic-auth username and the API key is the password, and check for whitespace or stale environment values.
  • The request is rejected for missing input: send exactly one of url or html. For a URL, include the scheme and hostname, such as https://example.com.
  • The page is inaccessible: confirm it is publicly reachable from the rendering service. For an authorized protected page, use the documented short-lived header credential approach; the API will not log in interactively.
  • The image looks clipped: use the documented full_screen option when the desired output is the full page, and check the width and height settings against the actual layout.
  • A signed URL does not validate: sign the exact encoded query string, preserving parameter order and whitespace, and do not generate the token in browser code.
  • The POST worked but no local file appeared: the response contains a generated image URL. Make a second request to that URL or embed it; the initial API response is not itself necessarily the PNG file.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its one-call API can return PNG, JPEG, WebP, or PDF, and its documented options include full-page capture, viewport and device settings, CSS and JavaScript, custom headers, and other capture controls. For an example of converting a URL to a PNG, request the image endpoint directly:

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

See the ScreenshotNeo API documentation for request parameters and response behavior. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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

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 *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.