scale property
ImageSaveOptions.scale property
Gets or sets the zoom factor for the generated images.
@property
def scale(self) -> float:
...
@scale.setter
def scale(self, value: float):
...
Remarks
The default value is 1.0. The value must be greater than 0.
Examples
Shows how to edit the image while Aspose.Words converts a document to one.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.paragraph_format.style = doc.styles.get_by_name('Heading 1')
builder.writeln('Hello world!')
builder.insert_image(file_name=IMAGE_DIR + 'Logo.jpg')
# When we save the document as an image, we can pass a SaveOptions object to
# edit the image while the saving operation renders it.
options = aw.saving.ImageSaveOptions(aw.SaveFormat.PNG)
options.image_brightness = 0.3
options.image_contrast = 0.7
options.horizontal_resolution = 72
options.vertical_resolution = 72
options.scale = 96 / 72
doc.save(file_name=ARTIFACTS_DIR + 'ImageSaveOptions.EditImage.png', save_options=options)
Shows how to render an Office Math object into an image file in the local file system.
doc = aw.Document(MY_DIR + 'Office math.docx')
math = doc.get_child(aw.NodeType.OFFICE_MATH, 0, True).as_office_math()
# Create an "ImageSaveOptions" object to pass to the node renderer's "save" method to modify
# how it renders the OfficeMath node into an image.
save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.PNG)
# Set the "scale" property to 5 to render the object to five times its original size.
save_options.scale = 5
math.get_math_renderer().save(ARTIFACTS_DIR + 'Shape.render_office_math.png', save_options)
See Also
- module aspose.words.saving
- class ImageSaveOptions