ScreenshotNeo

BlogComparisons

HTMLCSStoImage Image Format Options: PNG, JPEG, and WebP Compared

Learn how HTMLCSStoImage serves PNG, JPEG, and WebP, what its format setting changes, and how to choose an output for your workflow.

By the ScreenshotNeo team4 October 20267 min read

Short answer: HTMLCSStoImage stores raster renders as PNG. Its format option selects the extension in the returned image URL: png, jpg, or webp. Requesting a .jpg or .webp URL converts the stored PNG when served. If you omit the format, the extensionless URL serves PNG. The setting does not change the stored image definition, so you can request another supported extension for the same image ID later. See the HTMLCSStoImage format documentation.

There is no published, controlled comparison establishing which format produces the smallest file, best quality, or fastest response for equivalent HTMLCSStoImage renders. Choose based on the needs of the destination, then measure your own representative images if bytes or visual fidelity matter.

1. What the format option changes

The format setting controls the extension of the URL returned when you create an image. The stored raster image remains a PNG definition. When you request the resulting URL with .jpg or .webp, the service converts that stored PNG for delivery. The extension can therefore affect the delivered file without changing the underlying image ID or its HTML/CSS definition.

Request choice What is served Practical note
Omit format / extensionless URL PNG by default Good when you want the default lossless raster result.
png PNG Useful when you want an explicit format and broad support for crisp edges or transparency.
jpg JPEG, using the API’s jpg value and .jpg path extension Commonly used for photographic images; JPEG does not preserve alpha transparency.
webp WebP The format supports lossy and lossless compression, alpha transparency, and animation at the format level; this API comparison concerns a rendered still image.
pdf PDF output A separate document render path, not a raster format in this comparison.

Format values are case-insensitive according to the API documentation. In general prose, “JPEG” names the format; in API parameters and returned path extensions, use the vendor’s jpg spelling.

2. Which format should you choose?

Choose PNG for precise edges and transparency

PNG is a sensible default for interface captures, diagrams, text-heavy graphics, and assets where sharp boundaries or transparency matter. HTMLCSStoImage’s extensionless URL serves PNG, and explicitly setting png makes that intent clear in code. Keep in mind that this API stores raster renders as PNG regardless of which supported raster extension you later request.

Choose JPEG when the consuming system expects it

Use the API value jpg when an integration, publishing system, or downstream workflow requires JPEG. JPEG is not suitable when you need transparent pixels. The vendor’s format documentation does not provide a quality control setting or a measured file-size comparison in the research available for this article, so verify the actual returned image against your requirements.

Choose WebP when your delivery path supports it

WebP supports both lossy and lossless compression and can represent alpha transparency. Those are format capabilities defined by IETF RFC 9649, not a measured statement about HTMLCSStoImage’s output size, visual quality, or latency. Use webp when your browsers, clients, storage pipeline, and consumers accept WebP.

Keep PDF separate

Although the API also supports pdf, PDF is rendered and saved separately. It is intended for document-style output rather than choosing among three raster image encodings. Do not infer raster trade-offs from the PDF option.

3. Set the format in an HTMLCSStoImage request

The API introduced a request-body format option for HTML/CSS images, URL screenshots, saved-template images, and image batches, according to its changelog dated August 27, 2026. The exact fields surrounding format depend on the endpoint and authentication method you use. Add format with one of the supported values to the request body described by the relevant endpoint documentation. For example, the conceptual JSON field is:

{
  "format": "webp"
}

Use png, jpg, or webp for raster output. Use pdf only when you want the separate PDF output path. Because the returned URL and request schema vary by endpoint, follow the matching [HTMLCSStoImage API guide](https://htmlcsstoimage.com/docs/api/) for the full request and authentication fields rather than copying a guessed endpoint body.

After creation, use the URL returned by the API. To retrieve a different supported raster encoding for the same image, request the corresponding extension for that image ID as documented by the service. Do not assume that changing the format re-renders the HTML/CSS definition; the docs state that the format parameter changes the returned URL, not the stored image definition.

4. Compare outputs fairly

The available documentation explains the service’s storage and URL behavior but does not publish a controlled same-render comparison of PNG, JPEG, and WebP output size, visual fidelity, or response speed. Avoid universal claims such as “WebP is always smallest” for this API. If you need an answer for your particular workload, compare equivalent images:

  1. Choose representative HTML/CSS and keep the render definition identical.
  2. Request PNG, jpg, and WebP versions for the same image ID when available.
  3. Record each downloaded file’s byte size and inspect it at the actual display size.
  4. Check details that matter for your content, such as small text, fine lines, gradients, and transparent edges.
  5. Repeat for several image types; one photograph or one diagram is not representative of every workload.
  6. Measure request and retrieval times separately if latency matters, and repeat enough times to account for network variation.

This is a measurement procedure, not a claim that one format wins. The conversion behavior means retrieval may include format conversion; the docs reviewed do not quantify its time or cost.

5. Common issues and fixes

Symptom Likely cause What to do
The response URL has no extension. You omitted the format option or are using the default returned URL. The extensionless URL serves PNG by default. Set an explicit supported format if your consumer needs a particular extension.
You expected JPEG but the URL ends in .jpg. The API uses jpg as its value and extension spelling. Use jpg in the API and treat the delivered image as JPEG.
You requested a format but see the same image ID. The format selects how the image is served; it does not alter the stored image definition. Use the returned URL with the desired supported extension. Do not expect a new image definition or ID solely from changing the format.
Transparency is lost in a JPEG output. JPEG does not support alpha transparency. Use PNG or WebP when transparent pixels are required.
The file is larger than expected or visual details differ. There is no published product-specific benchmark or universal output-size guarantee across these formats. Compare equivalent renders from your own content and inspect the image at its intended size.
A consumer rejects the output. The downstream viewer, CMS, or pipeline may not accept that format or extension. Confirm supported formats at the receiving end, then request a compatible extension such as png or jpg.
You need a multipage or document output. You are treating PDF as a raster setting. Use the API’s separate PDF render path and its PDF-specific options.

6. Performance, reliability, and cost considerations

Changing the requested extension should be treated as a delivery-format choice, not as a guarantee of reduced bytes, faster rendering, or lower cost. The available source material does not report conversion latency, size savings, or pricing differences between the formats. Since JPG and WebP are served by conversion from stored PNG, include both image creation and URL retrieval in any timing measurements.

For a robust integration, inspect the API response and use its returned URL, handle failed requests and retrieval errors, and validate the actual response content type and file before passing it to another system. Keep a known-compatible format available as a fallback if your consumers have uneven format support. If the exact bytes need to be reproducible, retain the delivered file you validated rather than relying on undocumented conversion details.

7. ScreenshotNeo alternative for website screenshots

If your goal is to capture live websites rather than render HTML/CSS images through HTMLCSStoImage, ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-call API returns a screenshot or PDF and documents PNG, JPEG, and WebP output. See the ScreenshotNeo API documentation for its request options and behavior.

cURL

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

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`ScreenshotNeo request failed: ${res.status}`);
const bytes = new Uint8Array(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', bytes));

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, and failed loads are never billed, and responses identify the page verdict and billing status in headers. An MCP server lets AI agents use screenshot tools. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots. The same features are available on every plan.

Create a free ScreenshotNeo account for 1,000 screenshots a month with no card.

FAQ

Does HTMLCSStoImage store a separate JPEG or WebP image definition?

No. Its documentation says raster renders are stored as PNG, and the format parameter changes the returned URL rather than the stored image definition.

Can I change formats after image creation?

Yes. The documentation says the same image ID can be requested using another supported extension later.

Does the API’s JPEG value use jpeg or jpg?

Use jpg for the API value and .jpg extension. “JPEG” is the general format name.

Is WebP guaranteed to be smaller or faster?

No product-specific measurements in the sources establish that. Compare equivalent renders for your own content and delivery path.

Is PDF another image encoding?

No. The API supports PDF, but it uses a separate rendering and saving path.