Bug 127851 - Unnecessarily big replacement image for embedded PDF
Summary: Unnecessarily big replacement image for embedded PDF
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: PDF-Insert
  Show dependency treegraph
Reported: 2019-09-28 22:59 UTC by Gellért Gyuris
Modified: 2019-10-30 11:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:

Sample files (742.61 KB, application/zip)
2019-09-28 23:00 UTC, Gellért Gyuris

Note You need to log in before you can comment on or make changes to this bug.
Description Gellért Gyuris 2019-09-28 22:59:12 UTC
In case of an SVG file with big canvas: When I insert an SVG file (as image), LO creates a replacement PNG. It's OK. But when I export this SVG to PDF and insert that PDF as images, replacement file size (dpi) is unnecessarily big.

Steps to Reproduce:
1. Open /extras/source/gallery/symbols/Gift.svg file with an SVG editor and resize it to 100 cm × 100 cm. Save as plain SVG and export it to PDF too. (See attached examples).
2. Create a new LO document and insert SVG and PDF files as images.
3. See replacement PNG files in /Pitcures

Actual Results:
Size of SVG replacement PNG image is: 707×707 px. (51 kB)
Size of PDF replacement PNG image is: 3779×3779 px. (338 kB)

Expected Results:
Size of PDF replacement file should be the same size.

Reproducible: Always

User Profile Reset: No

Additional Info:
When I insert original sized SVG (100×100px) and PDF this size difference isn't noticeable.
Comment 1 Gellért Gyuris 2019-09-28 23:00:50 UTC
Created attachment 154628 [details]
Sample files
Comment 2 V Stuart Foote 2019-09-29 19:25:02 UTC

The SVG and the PDF get completely different filter handling for rendering to document canvas as BMP and save to archive as .PNG--no expectation they would end up the same resolution. The PDF insert filter currently generates an internal BMP at a fixed 96 dpi resolution (bug 115811) and that result gets used for PNG on save.

What is more troubling is why you do not retain the SVG and the PDF in your ODF document archive--both vector graphics are needed for rendering to print or PDF export. 

On Windows builds ( and current master/6.4.0) both the SVG and the PDF are saved and available for print or export rendering as vector images.
Comment 3 V Stuart Foote 2019-09-29 19:26:15 UTC
lets move taht to 'filters and storage' rather than 'printing and pdf export'
Comment 4 Xisco Faulí 2019-10-30 09:09:47 UTC
Closing as RESOLVED NOTABUG as explained in comment 2
Comment 5 Gellért Gyuris 2019-10-30 11:58:04 UTC
I found a workaround: completely disable creating replacement images in Expert Configuration: org.openOffce.Office.Common > Save > Grapchics > AddReplacementImages: false