A widespread use case for Aspose.HTML Cloud functions is file processing and converting. This article explains in a set of code examples how to convert HTML to Image file formats such as JPG, PNG, GIF, TIFF, and BMP. We will consider various scenarios of HTML to Image conversion: from storage to storage, from a local file system to a local drive, and from the Web to the local file system.
This article explains in a set of code examples how to convert an HTML document to JPEG, PNG, GIF, TIFF or BMP formats using Aspose.HTML Cloud SDKs and REST API calls.
Examples of HTML to Image Conversion
Aspose.HTML Cloud SDK allows you to fetch an HTML document from storage location by its name, from a URL or a local file on your drive, convert it to a specified format and save it to the storage or a local drive. The following code examples demonstrate how to convert HTML to Image formats for different cases. These examples show how to use available SDKs and REST API for conversion operations.
Example 1. Convert a local HTML file to JPEG and save the result to local path
JPEG is one of the most commonly used image formats. Its uniqueness is the controlled loss of quality during compression. Therefore, it is widely used to store and send graphic content (photos, scanned copies, digitized images) over the Internet.