Bug 99088 - Export to PNG messes up with DPI
Summary: Export to PNG messes up with DPI
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
5.2.0.1 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:svg, regression
Depends on:
Blocks: Graphics-Export Image-DPI SVG-Open
  Show dependency treegraph
 
Reported: 2016-04-04 19:09 UTC by S.
Modified: 2023-08-31 11:30 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
original SVG file (3.79 KB, image/svg+xml)
2016-04-04 19:09 UTC, S.
Details
SVG after editing with LibreOffice draw and only changing the fill color (3.93 KB, image/svg+xml)
2016-04-04 19:10 UTC, S.
Details
original SVG file opened in GIMP (128.83 KB, image/png)
2016-04-05 19:32 UTC, S.
Details
SVG after editing with LibreOffice Draw, opened in GIMP (126.15 KB, image/png)
2016-04-05 19:33 UTC, S.
Details
Halo effect as seen in an interface element (16.79 KB, image/png)
2016-04-05 19:54 UTC, S.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description S. 2016-04-04 19:09:25 UTC
Hello, I edited the color of the attached "orig.svg" file with LibreOffice Draw, and the result can be seen in "edited.svg". It creates a sort of halo effect around what should be a simple filled rectange.
Comment 1 S. 2016-04-04 19:09:46 UTC
Created attachment 124072 [details]
original SVG file
Comment 2 S. 2016-04-04 19:10:15 UTC
Created attachment 124073 [details]
SVG after editing with LibreOffice draw and only changing the fill color
Comment 3 raal 2016-04-05 16:43:59 UTC
Hello, I doesn't see halo effect. Could you post a prinscreen? In which software do you see this effect?
Comment 4 S. 2016-04-05 19:32:15 UTC
Created attachment 124106 [details]
original SVG file opened in GIMP
Comment 5 S. 2016-04-05 19:33:11 UTC
Created attachment 124107 [details]
SVG after editing with LibreOffice Draw, opened in GIMP
Comment 6 S. 2016-04-05 19:54:57 UTC
Created attachment 124108 [details]
Halo effect as seen in an interface element

This SVG is for an interface element in the Cinnamon desktop environment. You can clearly see the "halo" effect created by the LibreOffice edit in this screenshot.
Comment 7 Buovjaga 2016-04-13 11:39:02 UTC
(In reply to S. from comment #5)
> Created attachment 124107 [details]
> SVG after editing with LibreOffice Draw, opened in GIMP

How do you open it in GIMP? It says unsupported file format.

Inkscape shows it fine.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: b0e678c86136ef6d65cea66168a99217664c0278
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-04-11_23:06:28
Locale: fi-FI (fi_FI)
Comment 8 S. 2016-04-13 12:39:22 UTC
Hi there, I just used the normal version of Gimp that ships with openSUSE Tumbleweed.

But then again, Gimp isn't meant for SVG. The reason I filed this bug is for a UI decoration for the Cinnamon desktop environment. It clearly looks wrong in the interface after editing it with LibreOffice. (See attachment https://bug-attachments.documentfoundation.org/attachment.cgi?id=124108)
Comment 9 Buovjaga 2016-04-13 15:05:33 UTC
GIMP on Linux works.
For the original, it offers import settings width: 28, height: 4.
For the modified one, if offers import settings width: 35, height: 5.

If you use 28x4 for the modified one as well, there is no problem.

In the original <svg> element there are the attributes width="28" height="4".
In the modified one there is only stroke-width="28.222".

I will ask devs.
Comment 10 Buovjaga 2016-04-13 15:26:42 UTC
(In reply to Buovjaga from comment #9)
> In the modified one there is only stroke-width="28.222".

I made a mistake: there are width and height, but they are given in millimeters.
Comment 11 Aron Budea 2016-06-26 06:56:13 UTC
It seems to me that Draw does not take given DPI information into account.
Normal screen DPI is 72, DPI in orig.svg is 90, 72/90 = 0.8.
35/28 is 1.25, which is 1/0.8: if the DPI is smaller, it means the pixels are taking up proportionally larger area.

I don't know SVG format, and how important DPI is. Considering it's a vector format, and DPI is for raster images, probably not much, but of course if it's imported in a raster editor like GIMP, then it becomes important. I'm just not sure if there's any possible kind of interfacing when it comes to conversion.

Note that there's a bug report in Inkscape for using 90 DPI when saving SVGs regardless of default units set:
https://bugs.launchpad.net/inkscape/+bug/168753
(as I read, the 90 DPI comes from CSS 1 specification)

I'd tentatively say Draw could keep units in original file in mind, but that's not a huge issue.
However, there are bugs, see my next comment.
Comment 12 Aron Budea 2016-06-26 07:00:12 UTC Comment hidden (obsolete)
Comment 13 Heiko Tietze 2016-06-26 10:27:12 UTC Comment hidden (obsolete)
Comment 14 Aron Budea 2016-06-27 03:05:45 UTC
Thanks for testing, Heiko!

For the issues with Sidebar's numbers, I've opened bug 100632.

Regarding the size change, what is displayed upon reopening is a regression, but I wonder about the width/height in the exported SVG, 9.88mm/1.41mm corresponds to 28px/4px at 72 DPI, which isn't correct, and it's been like that since 3.3 (though there the exported SVG was a lot different). If that was rectified, that might affect GIMP's default behavior as well.

To have the exact regression in a single comment (pruned the part that belongs to the other bug report, disregard the incorrect 0 values):
> Open orig.svg in 5.1.4.2 (LibO fresh)
> 0.07/0.00/0.84/0.08 (Sidebar Ho/V/W/He)

> Export to new.svg, restart Draw and open new.svg
> 0.07/0.00/0.84/0.08 (Sidebar)

> Open orig.svg in 5.3.0.0 (Build ID: 7000e1a0640156645252d15d505949bff3d1eb4a) <= or 5.2.0.1
> 0.07/0.00/0.84/0.00

> new.svg
> 0.09/0.00/1.07/0.00 <- Regression issue confirmed

(0.07 -> 0.09, 0.84 -> 1.07)
Comment 15 Heiko Tietze 2016-07-14 09:46:12 UTC
Export to PNG produces a blurry raster graphic ('halo effect') while the same operation done with Inkscape results in sharp edges. Renaming the bug accordingly since SVG is loaded and processed without problems.
Comment 16 Xisco Faulí 2016-09-19 15:29:49 UTC Comment hidden (obsolete)
Comment 17 Buovjaga 2018-06-02 12:26:45 UTC
Bisected with bibisect-win32-5.2 to https://cgit.freedesktop.org/libreoffice/core/commit/?id=33e49a3b6655c1503dc81b583f5016fc3b2fda19

commit 33e49a3b6655c1503dc81b583f5016fc3b2fda19 (patch)
tree 2c5d140f629c84ea2d4d94d42989470de7172a3c
parent 49a32f4b2f1773df353bfd05af2f81d560025d18 (diff)
tdf#96046 SVG: use the same PPI as in svgio
Change-Id: I211dcc6fb242cfbd05636d42a811523de8e83be6
Reviewed-on: https://gerrit.libreoffice.org/20182

Adding Xisco to CC

Xisco: see comment 14's "To have the exact regression in a single comment"

I don't know why Heiko changed the topic to PNG. I bisected SVG exporting.
Comment 18 Xisco Faulí 2018-06-05 19:21:23 UTC
Adding Cc: to Xisco Fauli
Comment 19 QA Administrators 2019-06-21 02:52:13 UTC Comment hidden (obsolete)
Comment 20 QA Administrators 2021-08-25 03:53:39 UTC Comment hidden (obsolete)
Comment 21 QA Administrators 2023-08-26 03:18:00 UTC Comment hidden (obsolete)
Comment 22 Gabor Kelemen (allotropia) 2023-08-31 11:30:00 UTC
attachment 124072 [details] exported as PNG is still blurry in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0ab3f09011e4c4c1b85dda72f81f252899162ab5
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded