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]]