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. The picture file must use one of these formats (you cannot use .svg format):

  • .bmp

  • .emf

  • .eps

  • .gif

  • .jpeg

  • .jpg

  • .png

  • .tif

  • .tiff

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);

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