Issue 121128 - "Save Graphics..." exports SVG as hex-encoded PNG image
Summary: "Save Graphics..." exports SVG as hex-encoded PNG image
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 3.4.1
Hardware: All All
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Armin Le Grand
QA Contact:
Depends on:
Reported: 2012-09-27 15:12 UTC by Ariel Constenla-Haile
Modified: 2013-07-12 16:25 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Writer document with an SVG graphic embedded (26.28 KB, application/vnd.oasis.opendocument.text)
2012-09-27 15:12 UTC, Ariel Constenla-Haile
no flags Details
Original SVG image, embedded in Writer (9.76 KB, image/svg+xml)
2012-09-27 15:13 UTC, Ariel Constenla-Haile
no flags Details
Exported SVG graphic (7.69 KB, image/svg+xml)
2012-09-27 15:14 UTC, Ariel Constenla-Haile
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Ariel Constenla-Haile 2012-09-27 15:12:46 UTC
Created attachment 79660 [details]
Writer document with an SVG graphic embedded

* Insert an SVG image in Writer
* Select the graphic
* Right click to open the context menu
* Select the context menu item “Save Graphics...”
* On the Save dialog, select the “SVG – Scalable Vector Graphics” filter, enter a file name, and save the graphic
* Open the exported SVG graphic with a text editor: you'll see that the image was exported as an embedded, base 64 encoded, PNG image inside the SVG file <image xlink:href="data:image/png;base64,[IMAGE DATA]"/>

Exporting using AOO API works ok
Comment 1 Ariel Constenla-Haile 2012-09-27 15:13:35 UTC
Created attachment 79661 [details]
Original SVG image, embedded in Writer
Comment 2 Ariel Constenla-Haile 2012-09-27 15:14:38 UTC
Created attachment 79662 [details]
Exported SVG graphic

The original SVG image is exported as an hex-encoded PNG image embedded in the SVG file
Comment 3 Armin Le Grand 2012-09-27 15:37:57 UTC
ALG: Indeed, the image gets converted to bitmap content and then exported as SVG cotaining a big base64-encoded bitmap. Taking a look...
Comment 4 Armin Le Grand 2012-09-27 15:40:23 UTC
ALG: Same mechanism works in draw/impress. No context menu to export inserted graphic in SC.
Comment 5 Ariel Constenla-Haile 2012-09-27 15:46:13 UTC

some code I've found:

- void SwGrfShell::Execute(SfxRequest &rReq) in
main/sw/source/ui/shells/grfsh.cxx calls ExportGraphic( *pGraphic, sGrfNm );

- ExportGraphic in main/sw/source/ui/docvw/romenu.cxx call XOutBitmap::WriteGraphic

- XOutBitmap::WriteGraphic in main/svx/source/xoutdev/_xoutbmp.cxx 
does it handle SVG source graphics?
Comment 6 Armin Le Grand 2012-09-27 15:56:24 UTC
ALG: Thanks Ariel, I'm on it. I already got SwGrfShell::Execute and I'm compiling SW with debug (let's see if I will be able to link it , though :-)).
Other fingings show that SW does it it's own way, a way where saving is not yet implemented to take shortcuts if possible (if target format is original format...).
Comment 7 Armin Le Grand 2012-09-27 16:32:40 UTC
ALG: Added missing original data export for SVG in XOutBitmap::WriteGraphic, committed as revision 1391088.
Comment 8 binguo 2012-11-14 09:02:37 UTC
Verified on Aoo_Trunk_20121109.1800 rev 1407366
Comment 9 binguo 2012-11-14 09:02:56 UTC
close it.