convert_to_images method

convert_to_images(input_file, output_file)

Converts the pages of the specified input file to image files.

def convert_to_images(self, input_file: str, output_file: str):
    ...
ParameterTypeDescription
input_filestrThe input file name.
output_filestrThe output file name used to generate file name for page images using rule “outputFile_pageIndex.extension”

convert_to_images(input_file, output_file, save_format)

Converts the pages of the specified input file to image files in the specified format.

def convert_to_images(self, input_file: str, output_file: str, save_format: aspose.words.SaveFormat):
    ...
ParameterTypeDescription
input_filestrThe input file name.
output_filestrThe output file name used to generate file name for page images using rule “outputFile_pageIndex.extension”
save_formatSaveFormatSave format. Only image save formats are allowed.

convert_to_images(input_file, output_file, save_options)

Converts the pages of the specified input file to image files using the specified save options.

def convert_to_images(self, input_file: str, output_file: str, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
input_filestrThe input file name.
output_filestrThe output file name used to generate file name for page images using rule “outputFile_pageIndex.extension”
save_optionsImageSaveOptionsImage save options.

convert_to_images(input_file, load_options, output_file, save_options)

Converts the pages of the specified input file to image files using the provided load and save options.

def convert_to_images(self, input_file: str, load_options: aspose.words.loading.LoadOptions, output_file: str, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
input_filestrThe input file name.
load_optionsLoadOptionsThe input document load options.
output_filestrThe output file name used to generate file name for page images using rule “outputFile_pageIndex.extension”
save_optionsImageSaveOptionsImage save options.

convert_to_images(input_file, save_format)

Converts the pages of the specified input file to images in the specified format and returns an array of streams containing the images.

def convert_to_images(self, input_file: str, save_format: aspose.words.SaveFormat):
    ...
ParameterTypeDescription
input_filestrThe input file name.
save_formatSaveFormatSave format. Only image save formats are allowed.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(input_file, save_options)

Converts the pages of the specified input file to images using the specified save options and returns an array of streams containing the images.

def convert_to_images(self, input_file: str, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
input_filestrThe input file name.
save_optionsImageSaveOptionsImage save options.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(input_stream, save_format)

Converts the pages of the specified input stream to images in the specified format and returns an array of streams containing the images.

def convert_to_images(self, input_stream: io.BytesIO, save_format: aspose.words.SaveFormat):
    ...
ParameterTypeDescription
input_streamio.BytesIOThe input stream.
save_formatSaveFormatSave format. Only image save formats are allowed.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(input_stream, save_options)

Converts the pages of the specified input stream to images using the specified save options and returns an array of streams containing the images.

def convert_to_images(self, input_stream: io.BytesIO, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
input_streamio.BytesIOThe input stream.
save_optionsImageSaveOptionsImage save options.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(input_stream, load_options, save_options)

Converts the pages of the specified input stream to images using the provided load and save options, and returns an array of streams containing the images.

def convert_to_images(self, input_stream: io.BytesIO, load_options: aspose.words.loading.LoadOptions, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
input_streamio.BytesIOThe input stream.
load_optionsLoadOptionsThe input document load options.
save_optionsImageSaveOptionsImage save options.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(doc, save_format)

Converts the pages of the specified document to images in the specified format and returns an array of streams containing the images.

def convert_to_images(self, doc: aspose.words.Document, save_format: aspose.words.SaveFormat):
    ...
ParameterTypeDescription
docDocumentThe input document.
save_formatSaveFormatSave format. Only image save formats are allowed.

Returns

Returns array of image streams. The streams should be disposed by the end user.

convert_to_images(doc, save_options)

Converts the pages of the specified document to images using the specified save options and returns an array of streams containing the images.

def convert_to_images(self, doc: aspose.words.Document, save_options: aspose.words.saving.ImageSaveOptions):
    ...
ParameterTypeDescription
docDocumentThe input document.
save_optionsImageSaveOptionsImage save options.

Returns

Returns array of image streams. The streams should be disposed by the end user.

Examples

Shows how to convert document to images.

doc = MY_DIR + 'Big document.docx'
aw.lowcode.Converter.convert(input_file=doc, output_file=ARTIFACTS_DIR + 'LowCode.ConvertToImages.1.png')
aw.lowcode.Converter.convert(input_file=doc, output_file=ARTIFACTS_DIR + 'LowCode.ConvertToImages.2.jpeg', save_format=aw.SaveFormat.JPEG)
load_options = aw.loading.LoadOptions()
load_options.ignore_ole_data = False
image_save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.PNG)
image_save_options.page_set = aw.saving.PageSet(page=1)
aw.lowcode.Converter.convert(input_file=doc, load_options=load_options, output_file=ARTIFACTS_DIR + 'LowCode.ConvertToImages.3.png', save_options=image_save_options)
aw.lowcode.Converter.convert(input_file=doc, output_file=ARTIFACTS_DIR + 'LowCode.ConvertToImages.4.png', save_options=image_save_options)

Shows how to convert document to images stream.

doc = MY_DIR + 'Big document.docx'
streams = aw.lowcode.Converter.convert_to_images(input_file=doc, save_format=aw.SaveFormat.PNG)
image_save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.PNG)
image_save_options.page_set = aw.saving.PageSet(page=1)
streams = aw.lowcode.Converter.convert_to_images(input_file=doc, save_options=image_save_options)
streams = aw.lowcode.Converter.convert_to_images(doc=aw.Document(file_name=doc), save_format=aw.SaveFormat.PNG)
streams = aw.lowcode.Converter.convert_to_images(doc=aw.Document(file_name=doc), save_options=image_save_options)

Shows how to convert document to images from stream.

with system_helper.io.FileStream(MY_DIR + 'Big document.docx', system_helper.io.FileMode.OPEN, system_helper.io.FileAccess.READ) as stream_in:
    streams = aw.lowcode.Converter.convert_to_images(input_stream=stream_in, save_format=aw.SaveFormat.JPEG)
    image_save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.PNG)
    image_save_options.page_set = aw.saving.PageSet(page=1)
    streams = aw.lowcode.Converter.convert_to_images(input_stream=stream_in, save_options=image_save_options)
    load_options = aw.loading.LoadOptions()
    load_options.ignore_ole_data = False
    aw.lowcode.Converter.convert_to_images(input_stream=stream_in, load_options=load_options, save_options=image_save_options)

See Also