dagwieers/asciidoc-odf — Issue #23: LibreOffice does not do style:rel-width and style:rel-height properly
Author: dagwieers
Created: 2012-02-10 11:41:30+00:00
State: open

The current implementation in odt.conf for cover-images adds:

style:rel-width="100%" style:rel-height="scale".

For an image with the dimensions 2097x287, this should show the image in LibreOffice with a proportional width and height. However when opened in LibreOffice the width is indeed 100%, but the height seems to be the same as the width. So scale seems to be implementing "height" instead. If you look in the Picture-properties in LibreOffice you can see the following values:

(x) Keep scale
( ) Keep image size

-- Scale --------------
Width: 96%
Height: 2%

-- Image Size -------
Width: 170,00mm
Height: 0,41mm

Modifying this Scale to Width: 100% and Height: 100% does the right thing.

If you save the file again, LibreOffice adds it this to the draw:frame:

svg:width="177.69mm" svg:height="24.31mm"

Without this working properly, LibreOffice only understands exact dimensions. Which means as producer (ODF backend) you need to get image dimensions and apply that to the page dimensions and all kinds of crazy shit ;-)