to_image метод

to_image(self, stream, image_type)

Создает изображение фигуры и сохраняет его в потоке в указанном формате.


def to_image(self, stream, image_type):
    ...
ПараметрТипОписание
streamio.RawIOBaseВыходной поток.
image_typeImageTypeТип сохранения изображения.

Примечания

Поддерживаются следующие форматы: .bmp, .gif, .jpg, .jpeg, .tiff, .emf.

Пример

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

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

to_image(self, image_file, options)

Сохраняет форму в файле.


def to_image(self, image_file, options):
    ...
ПараметрТипОписание
image_filestr
optionsaspose.cells.rendering.ImageOrPrintOptions

Пример

from aspose.cells.rendering import ImageOrPrintOptions

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

to_image(self, stream, options)

Сохраняет форму в потоке.


def to_image(self, stream, options):
    ...
ПараметрТипОписание
streamio.RawIOBase
optionsaspose.cells.rendering.ImageOrPrintOptions

Пример

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

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

Смотрите также