New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG images incorrectly scaled (sometimes) #10
Comments
Thanks for your report and for the detailed analysis. I'm on an Windows system and don't have this problem. But I remember a similar issue when I was experimenting with importing PDF graphics into LibreOffice - the result was depending on the system's DPI settings. I'll care about the troubleshooting section. |
Interesting... Windows 10 |
Maybe it's not that complicated to add the missing "pt" unit to an svg file. |
I was intrigued, why exactly the tools would behave differently on different platforms. Some projects responded to the change (Inkscape did), some did not. Sorry for the long story, my point is:
|
Here is a new branch for an experimental version: In short: Before inserting an svg file, this version checks for the presence of the "pt" unit and adds it if it's missing. OXT download: |
Sorry, I've uploaded the wrong OXT file... it's updated now. ;-) |
Impressive. I tried it, works perfectly. |
Should be solved by v1.1.9: Please feel free to re-open if any problems persist. Cheers, |
Brilliant, thank you. |
I ran into a problem that images inserted by OOoLilypond are smaller than they should be.
(I was editing an older document and the reworked snippets shrunk by approx. 25% compared to those generated two years ago.)
After some trial and error it turned out it only happens when SVG is involved, PNG or EPS behave as expected.
I was using the "pdf to svg" route using the
pdf2svg
tool when I discovered the problem.When I changed the conversion tool to Inkscape, the problem disappeared.
Here's a document that hopefully illustrates the difference in size between the various outputs.
ooolilypond.odt
I did some more checking and found this difference:
Inkscape's SVG has dimensions with units, e.g.:
<svg width="190pt" height="41pt" viewBox="0 0 190 41">
whereas
pdf2svg
(andlilypond -dbackend=cairo
) produces the same numbers for the same input, but formats them without units:<svg width="190" height="41" viewBox="0 0 190 41">
I believe the "pt" unit corresponds to a pixel at 72dpi.
In my understanding, if no unit is specified, LibreOffice Writer interprets the image within the environment DPI, which in my case happens to be 96dpi - and that's why the result is smaller, because it assumes smaller pixels.
I suggest at least adding a topic to your troubleshooting section with an advice to try inkscape as conversion tool when experiencing a problem with unexpected scaling.
Maybe a solution could be to preprocess the generated svg file and add the "pt" unit when none is specified?
Thanks.
My environment: Gentoo Linux, Sway (wayland), LibreOffice 7.5.6, OOoLilyPond 1.1.8, Lilypond 2.24.0, pdf2svg 0.2.3, Inkscape 1.2.2
The text was updated successfully, but these errors were encountered: