Bug 45884 - LibreOffice does not understand "scale" value with style:rel-width and style:rel-height
Summary: LibreOffice does not understand "scale" value with style:rel-width and style:...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL: https://github.com/dagwieers/asciidoc...
Whiteboard: odf
Keywords:
Depends on:
Blocks: ODF-import
  Show dependency treegraph
 
Reported: 2012-02-10 03:44 UTC by Dag Wieers
Modified: 2022-09-15 01:44 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
AsciiDoc source for image test file (1.72 KB, text/plain)
2012-12-02 14:15 UTC, Dag Wieers
Details
Flat ODF file showing the reported problem (436.85 KB, application/vnd.oasis.opendocument.text)
2012-12-02 14:16 UTC, Dag Wieers
Details
odt with scale, showing the effects of the bug (1.05 MB, application/vnd.oasis.opendocument.text)
2022-09-15 01:43 UTC, João Vidal
Details
odt with dimensions, showing no problems on image sizes (712.26 KB, application/vnd.oasis.opendocument.text)
2022-09-15 01:43 UTC, João Vidal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dag Wieers 2012-02-10 03:44:54 UTC
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 ;-)

I believe this problem has always existed.
Comment 1 Dag Wieers 2012-02-10 07:17:08 UTC
The behavior one would expect is the behavior seen when pushing the "Original Size" button inside the Picture-proprties window.
Comment 2 Dag Wieers 2012-02-10 07:20:45 UTC
AFAICT LibO does not handle "scale", it does seem to handle percentages correctly.
Comment 3 sasha.libreoffice 2012-05-17 05:15:03 UTC
Thanks for bugreport
Please, attach odt file that demonstrates this problem
Comment 4 Dag Wieers 2012-12-02 14:15:53 UTC
Created attachment 70925 [details]
AsciiDoc source for image test file

This is the AsciiDoc source for the generated Flat ODF file showing the described problem.
Comment 5 Dag Wieers 2012-12-02 14:16:33 UTC
Created attachment 70926 [details]
Flat ODF file showing the reported problem

Flat ODF file showing the reported problem
Comment 6 Dag Wieers 2012-12-02 14:17:28 UTC
The attached Flat ODF file shows the (various) problems we see with including images into ODF.
Comment 7 QA Administrators 2013-09-24 01:48:11 UTC Comment hidden (obsolete)
Comment 8 Dag Wieers 2013-09-24 09:00:56 UTC
Bug was incorrectly set to NEEDINFO :-(
Comment 9 QA Administrators 2015-04-01 14:41:59 UTC Comment hidden (obsolete)
Comment 10 tommy27 2016-04-16 07:24:47 UTC Comment hidden (obsolete)
Comment 11 Michael Stahl (allotropia) 2016-04-18 09:50:31 UTC
well i don't remember anybody fixing anything there
Comment 12 Johannes Wilm 2016-10-01 16:32:41 UTC
I just tested it. This bug is still there.
Comment 13 QA Administrators 2018-12-16 03:50:39 UTC Comment hidden (obsolete)
Comment 14 V Stuart Foote 2019-11-11 14:35:27 UTC
Still have issues of OP in scaling images of attachment 70926 [details] correctly to canvas.

Version: 6.3.3.2 (x64)
Build ID: a64200df03143b798afd1ec74a12ab50359878ed
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 15 João Vidal 2020-07-17 12:20:42 UTC
I wrote a bash script to generate Writer files automatically, editing directly 'content.xml', adding images to 'Pictures' and then compressing all into an 'odt'.
I tried the easy way, configuring the fixed entries:
style:rel-width="scale" svg:height="1.499cm"
but all images were shrunk to a single pixel column.

I worked around this by checking original image dimension, estimating the final width and writing it to 'content.xml'. But it's not the elegant way to do it.

I'm using version 6.3.6.2, on Linux.
Comment 16 QA Administrators 2022-09-12 03:40:10 UTC Comment hidden (obsolete)
Comment 17 João Vidal 2022-09-15 01:43:14 UTC
Created attachment 182455 [details]
odt with scale, showing the effects of the bug
Comment 18 João Vidal 2022-09-15 01:43:55 UTC
Created attachment 182456 [details]
odt with dimensions, showing no problems on image sizes
Comment 19 João Vidal 2022-09-15 01:44:48 UTC
It's still present on LO 7.2.7 (my Linux distribution uses pacman, I can't install latest 7.4 with rpm or deb).

Using
    style:rel-width="scale" svg:height="1.499cm"
the images have a very small width. See attachment 'test_with_scale.odt'.

Using something like
    svg:width="1.438cm" svg:height="1.499cm"
the images have the expected size.. See attachment 'test_with_dimensions.odt'.