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:

Run the following command to access the supporting files used in this example.

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

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

add(pictureSlide,plane);

close(ppt);

The PPT API supports the image formats in the table.

Image FormatFile Extension
Windows® Enhanced Metafile.emf
Encapsulated PostScript®.eps
Graphics Interchange Format .gif
Joint Photographic Experts Group.jpeg, .jpg
Portable Network Graphics.png
Scalable Vector Graphics.svg
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