Bug 160760

Summary: Embedded SVG images rasterized when converted from ODM to ODT
Product: LibreOffice Reporter: ChenyHsu <bu56fo58>
Component: filters and storageAssignee: Not Assigned <libreoffice-bugs>
Status: REOPENED ---    
Severity: normal CC: quikee, stephane.guillou, vsfoote, xiscofauli
Priority: medium    
Version: 24.2.2.2 release   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 107805    

Description ChenyHsu 2024-04-21 07:46:24 UTC
Description:
Embed a svg image in a ODT document, and embed this document into another master document(ODM).

When exporting the master document to ODT,
All svg images are coverted to png, even if turn off image compression in export dialogue options.




Steps to Reproduce:
1. Embed svg image into ODT file 
2. Embed the ODT with svg images into a master document
3. Export master document (ODM) to ODT

Actual Results:
All svg images are coverted to png, even if turn off image compression in export dialogue options.

Expected Results:
Exported ODT from ODM should keep SVG image, not rasterizing them to PNG.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: 420(Build:2)
CPU threads: 8; OS: Linux 6.8; UI render: default; VCL: kf6 (cairo+wayland)
Locale: zh-TW (en_US.UTF-8); UI: en-US
24.2.2-2
Calc: threaded
Comment 1 V Stuart Foote 2024-04-21 13:59:00 UTC
Does the expert config stanza 'AddReplacementImages' set False improve things?
Comment 2 V Stuart Foote 2024-04-21 14:55:54 UTC
(In reply to V Stuart Foote from comment #1)
> Does the expert config stanza 'AddReplacementImages' set False improve
> things?

Just tested and toggling the 'AddReplacementImages' eliminates the .png on round trip through ODF ODM master document to ODF Text .odt--look in the Zip archive in the Pictures directory.

Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 3 ChenyHsu 2024-04-22 05:57:04 UTC
(In reply to V Stuart Foote from comment #2)
> (In reply to V Stuart Foote from comment #1)
> > Does the expert config stanza 'AddReplacementImages' set False improve
> > things?
> 
> Just tested and toggling the 'AddReplacementImages' eliminates the .png on
> round trip through ODF ODM master document to ODF Text .odt--look in the Zip
> archive in the Pictures directory.
> 
> Version: 24.2.2.2 (X86_64) / LibreOffice Community
> Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
> CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL:
> win
> Locale: en-US (en_US); UI: en-US
> Calc: CL threaded

I set 'AddReplacementImages' to false and restart libreoffice, but it still convert svg to png (all svgz files not present in the exported ODM -> ODT file) for some file.

I tried to create a simple file, and svg preserved, but with a complicate and big odm file, it still convert svg to png, is there a better way to debugging this?
Comment 4 V Stuart Foote 2024-04-22 11:34:11 UTC
Were the source ODF documents used in the ODM prepared before you set 'AddReplacementImages' false? If not, IIUC each will need to be reopened and saved to remove the .PNG replacment.

But I think you can go through and open each ODF archive and *remove* the .PNG replacements. The .PNG from the Pictures directory, and in each content.xml find the "<draw:image xlink:href=" for the .PNG as paired to the .SVG and delete the .PNG stanza there as well. Easily scripted with sed, perl, or vim
Comment 5 V Stuart Foote 2024-04-22 12:22:07 UTC
@Tomaž, Xisco -- am I missing something on the SVG handling coming out of an ODM?
Comment 6 ChenyHsu 2024-04-26 05:58:21 UTC
(In reply to V Stuart Foote from comment #4)
> Were the source ODF documents used in the ODM prepared before you set
> 'AddReplacementImages' false? If not, IIUC each will need to be reopened and
> saved to remove the .PNG replacment.
> 
> But I think you can go through and open each ODF archive and *remove* the
> .PNG replacements. The .PNG from the Pictures directory, and in each
> content.xml find the "<draw:image xlink:href=" for the .PNG as paired to the
> .SVG and delete the .PNG stanza there as well. Easily scripted with sed,
> perl, or vim

Open and save every file (embeded ODT and ODM) again with `AddReplacementImages=False` does not help, 
It seems if the master document is created with `AddReplacementImages=True`,
the exported file would get svg images rasterized, even if re-save the master document with   `AddReplacementImages=False`.

(Sorry for the dealyed reply, I am very busy these days.)