Next: , Previous: Tables in DocBook export, Up: DocBook export

12.7.5 Images in DocBook export

Images that are linked to without a description part in the link, like ‘[[file:img.jpg]]’ or ‘[[./img.jpg]]’, will be exported to DocBook using mediaobject elements. Each mediaobject element contains an imageobject that wraps an imagedata element. If you have specified a caption for an image as described in Images and tables, a caption element will be added in mediaobject. If a label is also specified, it will be exported as an xml:id attribute of the mediaobject element.

Image attributes supported by the imagedata element, like align or width, can be specified in two ways: you can either customize variable org-export-docbook-default-image-attributes or use the #+ATTR_DOCBOOK: line. Attributes specified in variable org-export-docbook-default-image-attributes are applied to all inline images in the Org file to be exported (unless they are overridden by image attributes specified in #+ATTR_DOCBOOK: lines).

The #+ATTR_DOCBOOK: line can be used to specify additional image attributes or override default image attributes for individual images. If the same attribute appears in both the #+ATTR_DOCBOOK: line and variable org-export-docbook-default-image-attributes, the former takes precedence. Here is an example about how image attributes can be set:

     #+CAPTION:    The logo of Org mode
     #+LABEL:      unicorn-svg
     #+ATTR_DOCBOOK: scalefit="1" width="100%" depth="100%"

By default, DocBook exporter recognizes the following image file types: jpeg, jpg, png, gif, and svg. You can customize variable org-export-docbook-inline-image-extensions to add more types to this list as long as DocBook supports them.