This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.Image class

Package: mlreportgen.dom

Create image to include in report


Create an image to include in a report.


imageObj = Image(imagePath) creates an image object containing the image file specified by imagePath.

The contents of the specified image file are copied into the output document when the document is closed. Do not delete the original file before it is copied into the document.

Input Arguments

expand all

Path of an image file, specified as a character vector. You can use these image formats.

Image FormatSupported Output Formats

Output Arguments

expand all

Image, represented by an mlreportgen.dom.Image object.


expand all

The output format must support the custom attributes of this document element.

Watermark height, specified in the form valueUnits. Use any of these values for units:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

Alternatively, you can specify the image height using the Image.Style property. For example:

Image.Style = {Height('4in')};

Example: '22pi'

ID for this document element, specified as a character vector. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

Map of hyperlink areas in image, specified as an mlreportgen.dom.ImageMap object

Path of image file, specified as a character vector.

Format objects that specify the format of a document element.

Name of image style, specified as a character vector. The style name is the name of a style specified in the style sheet of the document or document part to which this image is appended. The specified style defines the appearance of this image in the output document where not overridden by the formats specified by the Style property of this element.


Word output ignores the style name.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Vertical alignment of image, specified as one of these values:

  • 'top'

  • 'bottom'

  • 'middle'

Image width in the form valueUnits, where Units is an abbreviation for the units. These abbreviations are valid:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points





Use Image.append in a similar way to how you use ExternalLink.append.

Append a custom element to this image.


Use Image.clone in a similar way to how you use Paragraph.clone.

Clone this image

Was this topic helpful?