Download it now!
Bug 97778 - Inserting a linked SVG creates a PNG copy embedded on the file
Summary: Inserting a linked SVG creates a PNG copy embedded on the file
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.0.4.2 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:fodp, filter:fodt, filter:odp, filter:svg
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2016-02-12 00:15 UTC by João Paulo
Modified: 2020-03-06 00:56 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
SVG logo (8.77 KB, image/svg+xml)
2016-02-12 08:00 UTC, João Paulo
Details
Test file (18.54 KB, application/vnd.oasis.opendocument.text)
2016-02-12 08:01 UTC, João Paulo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description João Paulo 2016-02-12 00:15:03 UTC
Running LibreOffice 5.0.4.2 x64 (build id 2b9802c1994aa0b7dc6079e128979269cf95bc78) on Windows 8.1 x64, I discovered the following trivial bug which may be on older versions as well:

Whenever I insert a linked SVG image (not embedded), Writer also embeds a PNG copy inside the ODT file. Just one copy, even if I embed the same SVG image twice or more times on the document.

That doesn't happen when I insert a linked EMF image (also vector graphics, but Windows proprietary format).

This causes the files being larger than needed, as there is data duplication.

There is an easy workaround: Convert the SVG file to EMF (as I did), but it would be best if Writer accepted the linked SVG without embedding a PNG copy.
Comment 1 Joel Madero 2016-02-12 06:03:10 UTC
Please attach a file and then mark as UNCONFIRMED.

In the future when reporting bugs it is *always* better to attach a simple test file that we can investigate. Thanks.
Comment 2 João Paulo 2016-02-12 08:00:25 UTC
Created attachment 122564 [details]
SVG logo
Comment 3 João Paulo 2016-02-12 08:01:06 UTC
Created attachment 122565 [details]
Test file
Comment 4 João Paulo 2016-02-12 08:01:30 UTC
I found some files produced with the <meta:generator>LibreOffice/5.0.3.2$Windows_X86_64 LibreOffice_project/e5f16313668ac592c1bfb310f4390624e3dbfb75</meta:generator> which don't have the PNG embedded as a result of linking to a SVG, so I think it's safe to assume it's a regression from 5.0.3.2.

I attached two files, the official SVG logo and an ODT test file with it linked. Both files should be saved on the same folder to open with LibreOffice, but if you open the ODT file with a Zip tool such as 7-Zip, you can see clearly the Pictures subfolder. Also, the content.xml inside the ODT has the following code:

<draw:image xlink:href="../SVG%20Logo.svg" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" draw:filter-name="&lt;Todos os formatos&gt;"/><draw:image xlink:href="Pictures/10000201000000A8000000A8621A5520A3F8813F.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

Which shows LibreOffice is doing both things: Linking to the external SVG file and generating a PNG embedded on the document.
Comment 5 Buovjaga 2016-02-16 10:39:28 UTC
Reproduced from scratch with a different SVG.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: a6f876d45bd4e41a7143594a6cb11b6893a0f620
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-02-11_00:07:38
Locale: fi-FI (fi_FI)
Comment 6 QA Administrators 2017-10-30 08:30:57 UTC Comment hidden (obsolete)
Comment 7 João Paulo 2017-11-06 06:31:30 UTC
Running:
LibreOffice 5.4.2 x64, build ID 22b09f6418e8c2d508a9eaf86b2399209b0990f4
Locale pt-BR (pt_BR)
Windows 10 Pro

This bug is still present.

It wasn't present on 3.3.0.4 downloaded from "http://downloadarchive.documentfoundation.org/libreoffice/old/3.3.0.4/portable/".

As I told on Comment #4 (https://bugs.documentfoundation.org//show_bug.cgi?id=97778#c4), I found some documents with the "<meta:generator>LibreOffice/5.0.3.2$Windows_X86_64 LibreOffice_project/e5f16313668ac592c1bfb310f4390624e3dbfb75</meta:generator>" tag which don't have the PNG embedded as a result of linking to a SVG, so I think it's safe to assume it's a regression from 5.0.3.2.
Comment 8 João Paulo 2018-06-07 21:16:08 UTC
On LibreOffice 6.0.4.2 (x64), build ID 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf, this bug is still present, but worsened:

If I link the same SVG image into a document (again, I don't embedd, just link), if I save as Flat ODT (*.fodt), LibreOffice makes **two or more** copies of the SVG file converted to PNG inside <office:binary-data> elements.

There is no need to embedd the file data inside the *.odt and *.fodt files.

Instead of:

<draw:image xlink:href="../!Logotipo/Coruja.emf" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
         <draw:image mime-type="image/png">
          <office:binary-data>
[binary data here corresponding to a PNG file]
          </office:binary-data>
         </draw:image mime-type="image/png">

There should be only:

<draw:image xlink:href="../!Logotipo/Coruja.emf" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
Comment 9 Florian 2019-06-13 08:54:41 UTC
The bug persists in 6.2 as well.
Version: 6.2.4.2 Build-ID: 1:6.2.4-0ubuntu0.18.04.1~lo1

The version 6.1 was even worse and embedded .png binary data of linked images at least when saving in .fodt format.

Unfortunately users of the .fodt/xml saving format will do so to version their documents in a SCM system. Embedded binary data makes diffs/merges more stressful and is quite bad for diff-based SCMs like git.-> not so trivial
Comment 10 João Paulo 2020-03-06 00:56:01 UTC
I just noticed this bug also happens when inserting a linked PDF to a Writer document as well.  I used LibreOffice 6.4.1.2, Build ID 4d224e95b98b138af42a64d84056446d09082932.

Should I add the Keyword "filter:pdf" to the Keywords field and edit the bug subject to reflect this fact?  Or should I create a new bug?  I think both bugs are very similar to each other, but I don't know if they are related or are on different components.