EPUB to Image Conversion

In this article, you will find information on how to convert an EPUB to Image File Formats such as JPGPNGBMPTIFF and how to use ImageSaveOptions and ICreateStreamProvider parameters.

The static methods of the Converter class are primarily used as the easiest way to convert EPUB file into various formats. You can convert EPUB to Image in your C# application literally with a single line of code!

Convert EPUB to JPG

You can check the quality of EPUB to JPG conversion at this link: https://products.aspose.app/html/conversion/epub-to-jpg

The following C# code snippet shows how to convert EPUB to JPG using Aspose.HTML for .NET.

  1. Open an existing EPUB file;
  2. Create a new ImageSaveOptions object with JPG ImageFormat;
  3. Use the Converter.ConvertEPUB method of Converter class to save EPUB as a JPG image. You need to pass the EPUB stream, ImageSaveOptions, and output file path to the Converter.ConvertEPUB method to convert EPUB to JPG.

Convert EPUB to PNG

The following C# code snippet shows how to convert EPUB to PNG using Aspose.HTML for .NET.

  1. Open an existing EPUB file;
  2. Create a new ImageSaveOptions object with PNG ImageFormat;
  3. Use the Converter.ConvertEPUB method of Converter class to save EPUB as a PNG image. You need to pass the EPUB stream, ImageSaveOptions, and output file path to the Converter.ConvertEPUB method to convert EPUB to PNG.

Convert EPUB to BMP

You can check the quality of EPUB to BMP conversion at this link: https://products.aspose.app/html/conversion/epub-to-bmp

The following C# code snippet shows how to convert EPUB to BMP using Aspose.HTML for .NET.

  1. Open an existing EPUB file;
  2. Create a new ImageSaveOptions object with BMP ImageFormat;
  3. Use the Converter.ConvertEPUB method of Converter class to save EPUB as a BMP image. You need to pass the EPUB stream, ImageSaveOptions, and output file path to the Converter.ConvertEPUB method to convert EPUB to BMP.

Convert EPUB to GIF

The following C# code snippet shows how to convert EPUB to GIF using Aspose.HTML for .NET.

  1. Open an existing EPUB file;
  2. Create a new ImageSaveOptions object with GIF ImageFormat;
  3. Use the Converter.ConvertEPUB method of Converter class to save EPUB as a GIF image. You need to pass the EPUB stream, ImageSaveOptions, and output file path to the Converter.ConvertEPUB method to convert EPUB to GIF.

Convert EPUB to TIFF

You can check the quality of EPUB to TIFF conversion at this link: https://products.aspose.app/html/conversion/epub-to-tiff

The following C# code snippet shows how to convert EPUB to TIFF using Aspose.HTML for .NET.

  1. Open an existing EPUB file;
  2. Create a new ImageSaveOptions object with TIFF ImageFormat;
  3. Use the Converter.ConvertEPUB method of Converter class to save EPUB as a TIFF image. You need to pass the EPUB stream, ImageSaveOptions, and output file path to the Converter.ConvertEPUB method to convert EPUB to TIFF.

Save Options

ImageSaveOptions allows you to customize the rendering process. You can specify the image formatpage sizemarginscompression levelCSS media-type, etc. The following example shows how to use ImageSaveOptions and create the output image with custom page-size and background color:

To learn more about ImageOptions please read Fine-Tuning Converters article.

Output Stream Providers

If it is required to save files in the remote storage (e.g., cloud, database, etc.) you can implement ICreateStreamProvider interface to have manual control over the file creating process. This interface designed as a callback object to create a stream at the beginning of the document/page (depending on the output format) and release the early created stream after rendering document/page.

The example below shows how to implement and use the your own MemoryStreamProvider in the application: