When saving a Writer document containing a SVG to DOCX, it get rasterized to PNG due to the current limits of this format. The convertion to PNG is done using 96 ppi only and doesn't care about the SVGs dimensions (f.e. when it got resized in LibreOffice.
So, when loading a SVG with a dimension of 30 mm × 30 mm, it gets rendered to PNG with 96 ppi and a size of 30 mm × 30 mm. When scaling the SVG to 120 mm × 120 mm, it also gets rendered to 30 mm × 30 mm, but scaled to 120 mm afterwards. In "Expert Options", you can select "PixelExportResolution", but it is ignored.
Steps to Reproduce:
1. Download a reference SVG: https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/
2. Insert it into a Write document
3. Save it to DOCX
4. Open in Microsoft Office or unpack ZIP and find the media directory
Unsharp raster image, since the dimensions and pixel resolution is too low / fixed at a default value, which might be too low in many cases.
At least it's expected to render the SVG at the target dimensions, but it's highly recommended to set a proper resolution for high quality export/printing/viewing to DOCX.
User Profile Reset: Yes
OpenGL enabled: Yes
The problem occurs on all versions, which can read and display SVG files. Ghostscript, imagemagick and pstoedit have been installed and are reachable via path variable.
Thank you for reporting the bug.
it seems you're using an old version of LibreOffice.
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
I see this issue on version 18.104.22.168; restoring to UNCONFIRMED.
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug.
(Please note that the attachment will be public, remove any sensitive information before attaching it.
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Created attachment 153315 [details]
ODT document containing the same SVG image at two different sizes
When this document is resaved as DOCX using LibreOffice 22.214.171.124, the PNG images appear to be saved from the SVG source images according to the behavior described in the bug-opening comment.
Created attachment 153316 [details]
DOCX document containing PNG replacement images at two different sizes
This document is the DOCX saved using LibreOffice 126.96.36.199 from the ODT document attached above. The PNG images appear to be saved from the SVG source images according to the behavior described in the bug-opening comment.
This is also related to bug 126084, which points out the existence of a relatively new extension to Word that allows handling of SVG images with PNG fallback.
Created attachment 159109 [details]
ODT file with SVG and PNG equations
Created attachment 159110 [details]
File converted to doc format
Created attachment 159111 [details]
File converted to docx format
This bug affects the TexMaths extension (LaTeX equations in LibreOffice) ability to export SVG equations to MS Office.
Here is a small example in latest LibreOffice 6.4.2 and MS Word 2010:
- file test-6.4.2.odt contains two equations, one in SVG format, the other in PNG 600 dpi format
- file test-6.4.2.doc is the same file converted to MS doc format
- file test-6.4.2.docx is the same file converted to MS docx format
As can be seen, the exported SVG to PNG equation (in MS Word documents) has a low resolution and can't be used. The PNG equation is not affected.
Please note that exporting TexMaths SVG equations to MS Word worked in LO <= 6.0.7 and broke down from LO >= 6.1.0.
Two independent confirmations -> NEW
the SVG https://bugs.documentfoundation.org/attachment.cgi?id=159109 contains a size in pt:
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='16.045144pt' height='9.96264pt' viewBox='76.712329 55.292653 16.045144 9.96264'>
the result is apparently that the PNG is always 22x14 px regardless of the size of the SVG in the document (its enclosing draw:frame).
in a different example, svg size given in px (? i guess that's what unitless means)
<svg xmlns="http://www.w3.org/2000/svg" width="277" height="56">
here the result is dependent on the size of the draw:frame, but it looks like it doesn't scale as well as it should? from 277x56 to 346x70 if width is increased from 7.40cm to 11.20cm, it would be appropriate for 9.25 cm?
Created attachment 167512 [details]
svg with unitless size
See also bug 138653. The quality was acceptable - not perfect - prior to that commit (at least for the SVG file attached there)
*** This bug has been marked as a duplicate of bug 51510 ***