musescore / MuseScore

MuseScore is an open source and free music notation software. For support, contribution, bug reports, visit MuseScore.org. Fork and make pull requests!
https://musescore.org
Other
12.06k stars 2.6k forks source link

Wrong SVG page size #22531

Closed eiffel31 closed 3 weeks ago

eiffel31 commented 4 months ago

Issue type

Import/export issue

Bug description

Generated SVG does not correctly reflect page size.

Steps to reproduce

New partition Select page size A5 Export to SVG

Start of SVG generated file: ... <svg width="2098.8px" height="2977.2px" viewBox="0 0 2098.8 2977.2"

Open the file with inkscape, observe page size in mm: 555x787

This fails because MuseScore assumes 360 DPI and inkscape assumes 96 DPI.

The fix is quite simple: just output the size as it is defined by the page size. So, the line should be: <svg width="148mm" height="210mm" viewBox="0 0 2098.8 2977.2"

Note: the size in pixels has high similitude with A4 paper size (210x297), but this is just coincidence!

Screenshots/Screen recordings

No response

MuseScore Version

4.2.1

Regression

No.

Operating system

Debian 12.5

oktophonie commented 4 months ago

See also https://github.com/musescore/MuseScore/issues/20084

irwir commented 3 weeks ago

Remarks on px value. In CSS it is required to be 1/96 in for printed media, and the same value was typically used for html presentation on screen instead of actual pixel size. Inkscape can change value of px for import/export in Preferences - Input/Output - Imported images. Switching to unambiguous mm would be definitely beneficial.