URL to WebP with C#

Screenshot webpages as WebP with C#

No browser management required

Capture public webpages from C# with the HtmlCssToImage NuGet 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 C# 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": "webp",
"viewport_height": 480,
"viewport_width": 640
}
https://google.com
Screenshot of Google in a small viewport

C# workflow

Test the webpage capture before adding it to C#

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

Loading playground…

Managed screenshots

Skip the fragile parts of native C# 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 ASP.NET services and background workers free of local browser binaries and browser-process lifecycle code.

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 .webp result without building a separate pipeline for temporary files, uploads, storage, and delivery.

URL screenshot API

Send one C# request instead of running a browser

POST the webpage URL, capture settings, and format from C#. HCTI handles the browser lifecycle and returns the generated .webp URL.

  • Public webpage URL

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

  • WebP output

    Set format to webp and use the hosted .webp 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": "webp",
"viewport_width": 1200,
"viewport_height": 630
}

How it works

From webpage URL to a finished WebP

  1. Send the webpage URL

    Submit a public URL with format set to webp 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 .webp URL

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

Example code

Screenshot a webpage as WebP in C#

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

Official HCTI C# client · HtmlCssToImage

dotnet add package HtmlCssToImage
// dotnet add package HtmlCssToImage

using HtmlCssToImage;
using HtmlCssToImage.Models;
using HtmlCssToImage.Models.Requests;
using System.Collections.Generic;
using System.Text.Json.Nodes;

// In an application, use IHttpClientFactory through dependency injection:
// https://www.nuget.org/packages/HtmlCssToImage.DependencyInjection
using var httpClient = new HttpClient();
var hctiOps = new HtmlCssToImageOptions(Environment.GetEnvironmentVariable("HCTI_API_ID")!, Environment.GetEnvironmentVariable("HCTI_API_KEY")!);
var client = new HtmlCssToImageClient(httpClient, hctiOps);

var request = new CreateUrlImageRequest
{
    Url = "https://example.com",
    Format = RenderImageFormat.WEBP,
    ViewportHeight = 630,
    ViewportWidth = 1200,
};

using var result = await client.CreateImageAsync(request);
if (result.Success)
{
    Console.WriteLine(result.Response.Url);
}

Ready to capture?

Take your first WebP webpage screenshot

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