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(aw.drawing.ShapeType.RECTANGLE, 300, 450)
shape.image_data.set_image(IMAGE_DIR + "Barcode.png")
shape.image_data.fit_image_to_shape()

doc.save(ARTIFACTS_DIR + "Shape.FitImageToShape.docx")

See Also