Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
EPUB is an open XML-based format for digital books and publications designed for optimal viewing on various devices. Converting EPUB files to other formats is often necessary to leverage different capabilities and features of those formats. JPG files can contain high-quality image data with lossless compression. This unique compression feature allows to quickly and efficiently share JPG images and use them widely on the Web, computers, and mobile devices. With Aspose.HTML for Python via .NET, you can convert EPUB to JPG format programmatically with full control over a wide range of conversion parameters.
In this article, you find information on how to convert EPUB to JPEG using convert_epub() methods of the Converter class and how to apply ImageSaveOptions.
You can convert EPUB to other formats with Aspose.HTML for Python via .NET API in real time. First, load an EPUB file from your local drive or URL and then run the example. The save options in the example are set by default. You will immediately receive the conversion result as a separate file.
If you want to convert EPUB to JPG using ImageSaveOptions programmatically, please see the following Python code example.
To convert EPUB to JPG using ImageSaveOptions, you should follow a few steps:
format property is PNG. Here, you can set the required save options, such as page setup or resolution.ImageSaveOptions, and output file path to the convert_epub() method.Look at the following Python code snippet that shows how to convert EPUB to JPG with custom save options using Aspose.HTML for Python via .NET.
1# Convert EPUB to JPG using Python with custom settings
2
3import os
4import aspose.html.converters as conv
5import aspose.html.saving as sav
6import aspose.html.rendering.image as rim
7import aspose.html.drawing as dr
8import aspose.pydrawing as pd
9
10# Setup directories and define paths
11output_dir = "output/"
12input_dir = "data/"
13os.makedirs(output_dir, exist_ok=True)
14
15document_path = os.path.join(input_dir, "input.epub")
16save_path = os.path.join(output_dir, "epub-to-image.jpg")
17
18# Open an existing EPUB file for reading
19with open(document_path, "rb") as stream:
20
21 # Create an instance of ImageSaveOptions
22 options = sav.ImageSaveOptions(rim.ImageFormat.JPEG)
23 options.horizontal_resolution = dr.Resolution.from_dots_per_inch(150.0)
24 options.vertical_resolution = dr.Resolution.from_dots_per_inch(150.0)
25 options.background_color = pd.Color.bisque
26 options.page_setup.any_page.size = dr.Size(500, 1000)
27
28 # Convert EPUB to JPG
29 conv.Converter.convert_epub(stream, options, save_path)The
ImageSaveOptions class in Aspose.HTML for Python via .NET offers extensive customization options for converting EPUB content to various image formats, ensuring high-quality output tailored to your needs. Here’s a more detailed description of each property of ImageSaveOptions:
CssOptions, dictates how CSS properties are handled during conversion.Download the Aspose.HTML for Python via .NET library to successfully, quickly, and easily convert your HTML, MHTML, EPUB, SVG, and Markdown documents to the most popular formats.
Aspose.HTML offers a free online EPUB to JPG Converter that converts EPUB to JPG image with high quality, easy and fast. Just upload, convert your files and get results in a few seconds!
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.