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)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
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: 2024-04-01 16:38 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:

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

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 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/$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

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:
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
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 downloaded from "http://downloadarchive.documentfoundation.org/libreoffice/old/".

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/$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
Comment 8 João Paulo 2018-06-07 21:16:08 UTC
On LibreOffice (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">
[binary data here corresponding to a PNG file]
         </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: 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, 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.
Comment 11 QA Administrators 2022-03-07 03:29:57 UTC Comment hidden (obsolete)
Comment 12 João Paulo 2022-03-28 04:06:56 UTC
(In reply to QA Administrators from comment #11)
> Dear João Paulo,
> (...)
> If the bug is present, please leave a comment that includes the information
> from Help - About LibreOffice.
> If the bug is NOT present, please set the bug's Status field to
> RESOLVED-WORKSFORME and leave a comment that includes the information from
> Help - About LibreOffice.

This bug is still present on:

Version: (x86) / LibreOffice Community
Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: pt-BR (pt_BR); UI: en-US
Calc: threaded

> If you want to do more to help you can test to see if your issue is a

This bug is a regression from version / e5f16313668ac592c1bfb310f4390624e3dbfb75.
Comment 13 Buovjaga 2022-03-29 13:36:23 UTC
Not a regression in 5.0. Already seen in oldest of Linux 50max, 44max and 41max bibisect repos.
Comment 14 QA Administrators 2024-03-29 03:14:55 UTC Comment hidden (obsolete)
Comment 15 João Paulo 2024-04-01 16:38:48 UTC
Running Version: (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: pt-BR (pt_BR); UI: pt-BR
Calc: threaded

The bug is still present, the findings I wrote on Comment#4 still occurs.