13.12.8 Images in ODT export

Embedding images

The ODT export back-end processes image links in Org files that do not have descriptions, such as these links ‘[[file:img.jpg]]’ or ‘[[./img.jpg]]’, as direct image insertions in the final output. Either of these examples works:

[[file:img.png]]
[[./img.png]]

Embedding clickable images

For clickable images, provide a link whose description is another link to an image file. For example, to embed an image ‘org-mode-unicorn.png’ which when clicked jumps to https://orgmode.org website, do the following

[[https://orgmode.org][./org-mode-unicorn.png]]

Sizing and scaling of embedded images

Control the size and scale of the embedded images with the ‘ATTR_ODT’ attribute.

The ODT export back-end starts with establishing the size of the image in the final document. The dimensions of this size are measured in centimeters. The back-end then queries the image file for its dimensions measured in pixels. For this measurement, the back-end relies on ImageMagick’s identify program or Emacs create-image and image-size API. ImageMagick is the preferred choice for large file sizes or frequent batch operations. The back-end then converts the pixel dimensions using org-odt-pixels-per-inch into the familiar 72 dpi or 96 dpi. The default value for this is in display-pixels-per-inch, which can be tweaked for better results based on the capabilities of the output device. Here are some common image scaling operations:

Explicitly size the image

To embed ‘img.png’ as a 10 cm x 10 cm image, do the following:

#+ATTR_ODT: :width 10 :height 10
[[./img.png]]
Scale the image

To embed ‘img.png’ at half its size, do the following:

#+ATTR_ODT: :scale 0.5
[[./img.png]]
Scale the image to a specific width

To embed ‘img.png’ with a width of 10 cm while retaining the original height:width ratio, do the following:

#+ATTR_ODT: :width 10
[[./img.png]]
Scale the image to a specific height

To embed ‘img.png’ with a height of 10 cm while retaining the original height:width ratio, do the following:

#+ATTR_ODT: :height 10
[[./img.png]]

Anchoring of images

The ODT export back-end can anchor images to ‘as-char’, ‘paragraph’, or ‘page’. Set the preferred anchor using the ‘:anchor’ property of the ‘ATTR_ODT’ line.

To create an image that is anchored to a page:

#+ATTR_ODT: :anchor page
[[./img.png]]