compress_images method

compress_images(presentation, resolution)

Reduces the resolution of pictures in the presentation and deletes their cropped areas, similar to PowerPoint’s “Compress Pictures” applied to all pictures. Pictures on slides, layout slides and master slides are processed, including pictures inside group shapes and picture fills of shapes.

@staticmethod
def compress_images(presentation, resolution):
    ...
ParameterTypeDescription
presentationIPresentationThe presentation to process.
resolutionPicturesCompressionTarget resolution relative to the size at which each picture is displayed.

PicturesCompression.DOCUMENT_RESOLUTION leaves pictures unchanged.

Remarks

Pictures already at or below the target resolution are left unchanged; pictures are never upscaled.

Not processed: slide backgrounds, table cell fills, charts, SmartArt, GIF images (to preserve animation), SVG and metafile (EMF/WMF) images.

Cropped areas are removed permanently and cannot be restored in PowerPoint.

Exceptions

ExceptionDescription
RuntimeError(Proxy error(ArgumentNullException))presentation is None.

See Also