How to Create Thumbnail Image of Website Page in C# ?

This article shows you how to create the thumbnail image of web page.

  • Step 1: Download the Websites Screenshot .Net Component.
  • Step 2: Install it on your computer. You will get the WebsitesScreenshot.dll component in the folder.
  • Step 3: Open your visual studio project, add this dll in your project references and try the following sample code.

The following code sample shows you how to create thumbnail image of website page from URL. Use CaptureWebpage method and pass the URL or the local html file path to the method. You can create thumbnail with preserving aspect ratio. Use PreserveAspectRatio property to preserve original aspect ratio with fixed width or fixed height.

C# .Net Code.

    
WebsitesScreenshot.WebsitesScreenshot _Obj;
_Obj = new WebsitesScreenshot.WebsitesScreenshot();
WebsitesScreenshot.WebsitesScreenshot.Result _Result;
_Result = _Obj.CaptureWebpage("www.WebpageThumbnailer.com");
if (_Result == WebsitesScreenshot.
	WebsitesScreenshot.Result.Captured)
{
	_Obj.PreserveAspectRatio = true;
	_Obj.ImageHeight = 200;
	_Obj.SaveImage("c:\\WebpageThumbnailer.jpg");
}
_Obj.Dispose();

VB .Net code.

    
Dim _Obj As New WebsitesScreenshot.WebsitesScreenshot
Dim _Result As WebsitesScreenshot.WebsitesScreenshot.Result
With _Obj
	_Result = .CaptureWebpage("www.WebpageThumbnailer.com")
	If _Result = WebsitesScreenshot.WebsitesScreenshot. _
						Result.Captured Then
		.PreserveAspectRatio = True
		.ImageHeight = 100
		.SaveImage("c:\WebpageThumbnailer.jpg")
	End If
End With
_Obj.Dispose()