Included with HTML to PDF v22.0.0

HTML to Image Converter for .NET

Besides the HTML to PDF converter, ExpertPdf offers an HTML to image converter, included in the same assembly. Capture a URL or an HTML string as a JPG, PNG, BMP, GIF or TIFF image: a thumbnail of a website page or a full size screenshot, from C# or VB.NET.

Just like the PDF converter, the image converter supports HTML5 and CSS3. Save the image on disk, get it as a byte array, or as a System.Drawing.Image object.

NuGet · ExpertPdf.HtmlToPdf.NetCore C# & VB.NET samples included
Output JPG · PNG · BMP · GIF · TIF
Assembly Included with the HTML to PDF converter
Targets .NET Framework to .NET 11

Everything the image converter does.

Capture URLs, HTML strings and local files as images in the standard formats, with the same HTML5 and CSS3 support as the PDF converter.

Capture

What the converter can render.

Web pages and HTML strings, over HTTP, HTTPS or from a local file. The whole page or a fixed browser window.

Full size screenshot

Take a snapshot of a whole web page into one image, without scrollbars.

Website thumbnails

Generate a thumbnail image of a website page.

URL, HTML string or local file

Retrieve the page to capture over HTTP or HTTPS, or from a local file, or convert an HTML string with a base URL for its relative paths.

HTML5 and CSS3

Just like the PDF converter, the image converter supports the modern HTML5 and CSS3 tags, with the same rendering engines, selected with the RenderingEngine property.

Output formats

Five image formats.

The same methods for every format: pass a different System.Drawing.Imaging.ImageFormat value.

PNG

Convert HTML to PNG with ImageFormat.Png.

JPEG

Convert HTML to JPG with ImageFormat.Jpeg.

BMP

Convert HTML to BMP with ImageFormat.Bmp.

GIF

Convert HTML to GIF with ImageFormat.Gif.

TIFF

Convert HTML to TIF with ImageFormat.Tiff.

Output & runtime

Where the image goes.

Disk or memory. Timeouts and delays for slow pages. A multithreaded architecture.

Save on disk or in memory

Save the generated image to a file, or get it as a byte array to store or send over HTTP.

Get a System.Drawing.Image

Get the result as an Image object to process further in your application.

Page load timeout

Set the number of seconds the converter waits for the web page to load.

Chromium and Blink

Capture with the new Chromium engine (CEF 154) or with Blink (Chromium 148), with a transparent background when the page has none.

Async and time limit

Asynchronous methods with cancellation, such as GetImageBytesFromUrlAsync, and a time limit for one capture with MaxConversionTime.

Delayed snapshots

Wait an additional number of seconds after the page loads, for content loaded asynchronously, before the snapshot is taken.

Multithreaded

A multithreaded architecture for the simultaneous processing of multiple requests.

32-bit and 64-bit

Works in 32-bit and 64-bit environments, with no printer driver or third party tools. Assemblies for .NET 2.0 and .NET 4.0 or above, and NuGet packages for .NET Core and .NET 5 to .NET 10.

A URL, captured as an image.

Create an ImgConverter with the browser window size, then convert a URL, an HTML string or an HTML file. The Thumbnail tabs scale the captured page down to a thumbnail. C# and VB.NET samples ship with the download.

Program.cs · C#
using System.Drawing.Imaging;
using ExpertPdf.HtmlToPdf;

// A 1024 pixels wide browser window. The height is detected
// from the page, so the image shows the whole page.
var imgConverter = new ImgConverter(1024);
imgConverter.LicenseKey = "your license key";

// Wait up to 60 seconds for the page to load, then 2 more
// seconds for content loaded by scripts
imgConverter.NavigationTimeout = 60;
imgConverter.ConversionDelay = 2;

// A URL to a PNG file
imgConverter.SaveImageFromUrlToFile("https://www.example.com/",
    ImageFormat.Png, "page.png");

// An HTML string to JPEG bytes; the base URL resolves relative paths
string html = File.ReadAllText("page.html");
byte[] jpg = imgConverter.GetImageBytesFromHtmlString(html,
    ImageFormat.Jpeg, "https://www.example.com/");

Install with dotnet add package ExpertPdf.HtmlToPdf.NetCore, the same package as the HTML to PDF Converter. The API reference describes the ImgConverter class and its methods.

Image converter questions, answered.

Common questions about capturing pages, image formats and slow pages.

How is this different from the HTML to PDF Converter?
The two converters are in the same assembly and support the same HTML5 and CSS3 features. The PdfConverter class produces a PDF document, the ImgConverter class produces an image.
What image formats are supported?
JPG, GIF, PNG, BMP and TIF. You choose the format with a System.Drawing.Imaging.ImageFormat value, such as ImageFormat.Png or ImageFormat.Jpeg.
Can I capture the whole page, not only the visible part?
Yes. Create the converter with only the browser window width, new ImgConverter(1024): the height is detected from the page and you get a snapshot of the whole web page in one image, without scrollbars.
How do I make a website thumbnail?
Capture the page as a System.Drawing.Image with GetImageFromUrl, then scale the image down to the thumbnail size, for example with a new Bitmap of the size you need. The Thumbnail tab of the code sample shows how.
How do I handle pages that load slowly?
Set NavigationTimeout, the number of seconds the converter waits for the page to load (60 by default), and ConversionDelay, an additional number of seconds to wait for content loaded asynchronously before the snapshot is taken.
Where can I get the image?
In a file (SaveImageFromUrlToFile), as a byte array (GetImageBytesFromUrl) or as a System.Drawing.Image object (GetImageFromUrl). The same methods exist for HTML strings, HTML files and HTML streams.
Which platforms are supported?
The download has assemblies for .NET 2.0 and .NET 4.0 or above, and the ExpertPdf.HtmlToPdf.NetCore NuGet package works with .NET Core and .NET 5 to .NET 11. The converter works in 32-bit and 64-bit environments, needs no printer driver or third party tools, and has a multithreaded architecture for processing several requests at the same time.
Can I try it before buying?
Yes. The evaluation version of the HTML to PDF Converter, which includes the HTML to Image Converter, is fully functional and can be used for an unlimited time. Download it with the C# and VB.NET samples, and license it on the pricing page when you are ready.

Capture web pages as images from .NET.

Download the free trial of the HTML to PDF Converter, which includes the HTML to Image Converter, with C# and VB.NET samples. When you are ready, license it on the pricing page.

Targets.NET Framework · .NET Core · .NET 5 to 11
Versionv22.0.0 · November 20, 2026