Description: Importing a HTML file with a picture encoded in base64 results in a very large picture that didn't conserve the aspect ratio. Steps to Reproduce: 1. Open attached HTML page with Writer (a report created from an R Markdown document) Actual Results: Picture is stretched vertically (maybe?) and squashed horizontally. The aspect ratio is not kept. Expected Results: Aspect ratio should at least be kept, and height should probably not be as big. Reproducible: Always User Profile Reset: No Additional Info: Versions tested: Version: 7.2.0.0.alpha1+ / LibreOffice Community Build ID: 7f3c9da5a0a8f27e3fe63c39a30fc08e34246420 CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-06-10_17:32:52 Calc: threaded Version: 7.1.3.2 / LibreOffice Community Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1 CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Version: 7.0.6.2 Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded 7.1.3 opened in Web View, but still the same size issue.
Created attachment 172783 [details] example HTML document This HTML document is the output of an R Markdown file.
Created attachment 172784 [details] Screenshot of Writer 7.2 after opening the HTML file
Created attachment 172785 [details] screenshot of HTML document opened in Firefox 89
Created attachment 172786 [details] PNG picture exported from Firefox, for reference
Reproduced in earlier version as well: Version: 6.2.5.2 Build ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159 CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3; Locale: en-AU (en_AU.UTF-8); UI-Language: en-US Calc: threaded One can restore the right aspect ratio by going to: image context menu > Crop tab > Click "Original size" The issue seems to be that, when opening the file, the height of the picture is scaled to 200% (but the width is 100%).
it does in ubuntu 20.04...
Created attachment 173445 [details] image import html
(In reply to paulo g. from comment #7) > Created attachment 173445 [details] > image import html i have test it in 7.3
Paulo, given that you reproduced the bug, could you please set the status to "NEW"? Cheers :)
Just a question/remark about the problem. What do we expect should LO do in the following cases: 1) Width/Height given -> take both values for Writer 2) Height/width given -> calculate the respective width/height and automatically keep the aspect ratio? 3) Nothing given -> take the original size
(In reply to Andreas Heinisch from comment #10) > Just a question/remark about the problem. What do we expect should LO do in > the following cases: > > 1) Width/Height given -> take both values for Writer > 2) Height/width given -> calculate the respective width/height and > automatically keep the aspect ratio? > 3) Nothing given -> take the original size What is the difference between 1) and 2) ?
Sry, was not specific enough. If you have given only the width, calculate the respective height keeping the aspect ratio and vice versa.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/7a2d8ee2b45b8dd0f614614368ae90878e51a645 tdf#142781 - Calculate width/height keeping aspect ratio It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
This patch still does not address some corner cases during the import of an image in an html document. For instance, if the width/height is explicitly set to 0, LO tries to retrieve some default value for the image, whereas a modern browser does not show the image. Maybe there will be some follow ups for this fix, if there are any new bug reports for importing an html document including images.
Created attachment 176305 [details] Screenshot: fixed in LO 7.3 alpha1 Thank you Andreas! Verified as fixed in: Version: 7.3.0.0.alpha1+ / LibreOffice Community Build ID: eec32be26d5d5805c1cb8cb53ce9702c04829819 CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded