compress_image method

compress_image

Compresses the image by reducing its size based on the shape size and specified resolution. Optionally, it also deletes cropped areas.

Returns

A bool indicating whether the image was successfully compressed. Returns True if the image was resized or cropped, otherwise False.

def compress_image(self, delete_cropped_areas_of_image, resolution):
    ...
ParameterTypeDescription
delete_cropped_areas_of_imageboolIf true, the method will remove the cropped areas of the image, potentially further reducing its size.
resolutionfloatThe target resolution in DPI. This value must be positive and defines how the image will be resized.

Remarks

This method changes the image’s size and resolution similar to PowerPoint’s “Picture Format -> Compress Pictures” feature.

Exceptions

ExceptionDescription
RuntimeError(Proxy error(ArgumentException))Thrown when the resolution is not a positive value.

See Also