Main Content

Create and Format Pictures

Create a Picture

To create a picture for a presentation, use the mlreportgen.ppt.Picture constructor. Specify the path to a picture file. For example:

import mlreportgen.ppt.*
slides = Presentation('slides');
pictureSlide = add(slides,'Blank');

plane = Picture(which('b747.jpg'));
plane.Width = '5in';
plane.Height = '2in';

add(pictureSlide,plane);

close(slides);

The PPT API supports the image formats in the table. The Scalable Vector Graphics (SVG) format is not supported.

Image FormatFile Extension
Bitmap.bmp
Enhanced Metafile.emf
Encapsulated PostScript®.eps
Graphics Interchange Format .gif
Joint Photographic Experts Group.jpeg, .jpg
Portable Network Graphics).png
Tagged Image File Format.tif, .tiff

Note

To ensure that the image formats used in your generated presentation are supported by the PowerPoint® version that you are using, see File formats that are supported in PowerPoint on the Microsoft® website.

Format a Picture

When you create a Picture object, you can specify the location, width, and height. The specified formatting applies when you add a picture to a slide or replace a Picture object. When you replace a PicturePlaceholder object with a Picture object, PowerPoint adjusts the replacement picture to fit the location and dimensions of the placeholder.

You can specify these format properties for a Picture object.

Picture Object Formatting Format ObjectFormat Property

Upper-left x-coordinate of picture

n/a

X

Upper-left y-coordinate of picture

n/a

Y

Picture width

n/a

Width

Picture height

n/a

Height

See Also

Classes

Related Examples

More About