Download it now!
Bug 121831 - Low raster quality when saving SVG as PNG to DOC(X)
Summary: Low raster quality when saving SVG as PNG to DOC(X)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:docx, filter:svg
Depends on:
Blocks: DOCX-Images Graphics-Export SVG-Save
  Show dependency treegraph
 
Reported: 2018-11-30 19:29 UTC by Tobias Wendorff
Modified: 2020-05-29 17:24 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
ODT document containing the same SVG image at two different sizes (13.85 KB, application/vnd.oasis.opendocument.text)
2019-08-12 05:30 UTC, d5ous.dev
Details
DOCX document containing PNG replacement images at two different sizes (10.07 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2019-08-12 05:32 UTC, d5ous.dev
Details
ODT file with SVG and PNG equations (14.59 KB, application/vnd.oasis.opendocument.text)
2020-03-29 09:06 UTC, Roland Baudin
Details
File converted to doc format (13.00 KB, application/msword)
2020-03-29 09:07 UTC, Roland Baudin
Details
File converted to docx format (8.05 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-03-29 09:07 UTC, Roland Baudin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Wendorff 2018-11-30 19:29:14 UTC
Description:
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

Actual Results:
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.

Expected Results:
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.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
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.
Comment 1 Xisco Faulí 2019-01-14 16:57:40 UTC
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.
Comment 2 d5ous.dev 2019-06-25 11:39:04 UTC
I see this issue on version 6.2.2.2; restoring to UNCONFIRMED.
Comment 3 Xisco Faulí 2019-08-09 11:56:06 UTC
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.
Comment 4 d5ous.dev 2019-08-12 05:30:56 UTC
Created attachment 153315 [details]
ODT document containing the same SVG image at two different sizes

When this document is resaved as DOCX using LibreOffice 6.2.2.2, the PNG images appear to be saved from the SVG source images according to the behavior described in the bug-opening comment.
Comment 5 d5ous.dev 2019-08-12 05:32:26 UTC
Created attachment 153316 [details]
DOCX document containing PNG replacement images at two different sizes

This document is the DOCX saved using LibreOffice 6.2.2.2 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.
Comment 6 d5ous.dev 2019-08-12 05:35:36 UTC
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.
Comment 7 Roland Baudin 2020-03-29 09:06:52 UTC
Created attachment 159109 [details]
ODT file with SVG and PNG equations
Comment 8 Roland Baudin 2020-03-29 09:07:23 UTC
Created attachment 159110 [details]
File converted to doc format
Comment 9 Roland Baudin 2020-03-29 09:07:46 UTC
Created attachment 159111 [details]
File converted to docx format
Comment 10 Roland Baudin 2020-03-29 09:08:08 UTC
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.
Comment 11 Buovjaga 2020-05-29 17:24:45 UTC
Two independent confirmations -> NEW