to_image method

to_image

Creates the shape image and saves it to a stream in the specified format.

def to_image(self, stream, image_type):
    ...
ParameterTypeDescription
streamio.RawIOBaseThe output stream.
image_typeImageTypeThe type in which to save the image.

Remarks

The following formats are supported: .bmp, .gif, .jpg, .jpeg, .tiff, .emf.

Example

from aspose.cells.drawing import ImageType
from io import BytesIO

imageStream = BytesIO()
shape.to_image(imageStream, ImageType.PNG)

to_image

Saves the shape to a file.

def to_image(self, image_file, options):
    ...
ParameterTypeDescription
image_filestr
optionsaspose.cells.rendering.ImageOrPrintOptions

Example

from aspose.cells.rendering import ImageOrPrintOptions

op = ImageOrPrintOptions()
shape.to_image("exmaple.png", op)

to_image

Saves the shape to a stream.

def to_image(self, stream, options):
    ...
ParameterTypeDescription
streamio.RawIOBase
optionsaspose.cells.rendering.ImageOrPrintOptions

Example

from aspose.cells.rendering import ImageOrPrintOptions
from io import BytesIO

imageStream = BytesIO()
op = ImageOrPrintOptions()
shape.to_image(imageStream, op)

See Also