How are images included in DITA topics?

In DITA topics, including images is essential for creating visually engaging content. Images can be inserted using the <image> element, which allows specifying the image file, alternative text, and other attributes.

To include images in DITA topics, the <image> element is used. This element serves as a placeholder for the image, allowing various attributes to be provided to define its source, display properties, and accessibility information.

Defining the Image Source:

The href attribute within the <image> element specifies the image’s source file, either a local file path or a URL.

Alt Text for Accessibility:

To ensure accessibility, the alt attribute provides alternative text for the image. This text is displayed when the image can’t be loaded or by screen readers for visually impaired users.

Scaling and Sizing:

DITA allows control of the image’s display properties. For example, the scalefit attribute can be set to “yes” to ensure the image fits the available space.

Example:

An image of a product is being included in that product’s DITA topic.


<p>This is our latest product, the XYZ-5000. <image href="images/product_xyz5000.jpg" alt="XYZ-5000 Product Image"/></p>

In this example, the <image> element is used within a paragraph (<p>) to include an image of the product. The href attribute points to the image file, and the alt attribute provides alternative text for accessibility. This results in a visually enriched DITA topic that describes the product with an associated image.