No browser runtime to maintain
Keep ASP.NET services and background workers free of local browser binaries and browser-process lifecycle code.
HTML to WebP with C#
No browser management required
Render HTML and CSS from C# with the HtmlCssToImage NuGet package without installing Chrome, running Playwright or Selenium, or building a separate image-storage pipeline.
C# workflow
Adjust the HTML and CSS here, then use the C# example below instead of recreating the browser-rendering workflow locally.
Managed rendering
Keep the application code focused on the request and response while HCTI manages Chromium, render isolation, retries, and hosted output.
Keep ASP.NET services and background workers free of local browser binaries and browser-process lifecycle code.
Use managed browser versions, isolated render jobs, built-in timing controls, and consistent viewport behavior across deployments.
Receive the hosted .webp result without building a separate pipeline for temporary files, uploads, storage, and delivery.
HTML to image API
POST the HTML, CSS, and format from C#. HCTI handles the browser lifecycle and returns the generated .webp URL.
Send complete markup and styles, including browser-supported fonts, images, SVG, and JavaScript.
Set format to webp and use the hosted .webp URL returned by the API.
Set viewport dimensions and device scale, or crop the result to a CSS selector.
Choose light or dark mode, timezone, and screen or print media.
How it works
Submit the content with format set to webp and any viewport or browser settings.
The API loads the markup, styles, fonts, and assets in a managed browser environment.
Embed the hosted result, download the file, or save it in your own storage and application records.
Output formats
Keep the same HTML and CSS. Choose lossless detail, compact compatibility, modern web delivery, or a paginated document.
Looking to capture a webpage as WebP? Explore URL to WebP in C# with the HCTI NuGet packageCrisp text, sharp UI details, and transparent backgrounds for designed graphics.
Explore PNGSmaller files and broad compatibility for photography, previews, and content-heavy pages.
Explore JPEGPaginated documents with page sizing, margins, backgrounds, and print styles.
Explore PDFExample code
Copy a complete C# request. Authentication, HTML, CSS, viewport settings, and response handling are shown together.
// 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 CreateHtmlCssImageRequest
{
Html = """
<div class="card">
<h1>Hello, world!</h1>
<p>Generated from HTML and CSS.</p>
</div>
""",
Css = """
.card {
width: 480px;
padding: 40px;
background: #f0fdf4;
color: #052e16;
font-family: sans-serif;
}
""",
};
using var result = await client.CreateImageAsync(request);
if (result.Success)
{
Console.WriteLine(result.Response.Url);
}
Ready to render?
Send HTML and CSS to the API and receive a hosted .webp image URL without running browser infrastructure.