fit_image_to_shape method

fit_image_to_shape()

Fits the image data to Shape frame so that the aspect ratio of the image data matches the aspect ratio of Shape frame.

def fit_image_to_shape(self):
    ...

Examples

Shows hot to fit the image data to Shape frame.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
# Insert an image shape and leave its orientation in its default state.
shape = builder.insert_shape(shape_type=aw.drawing.ShapeType.RECTANGLE, width=300, height=450)
shape.image_data.set_image(file_name=IMAGE_DIR + 'Barcode.png')
shape.image_data.fit_image_to_shape()
doc.save(file_name=ARTIFACTS_DIR + 'Shape.FitImageToShape.docx')

See Also