Export a musicXML-file in png-images(width*height pixel)

• Feb 24, 2017 - 09:45

The formula :
size_tenth = ((size_pixel * 25.4 ) / resolution_dpi ) * ( tenth / millimeters )

The parameters are :
size_pixel in a png-image generated by the command line MuseScore.exe -o
resolution_ dpi specified in MuseScore.exe -r
tenth : specified in musicXML <scaling/tenth>>
millimeters : specified in musicXML <scaling/miilimeters>
size_tenth : specified in musicXML <page-layout> <page-height> or <page-width> or <xx-margin>

the command line is :
MuseScore.exe -s -m -r <resolution_dpi> musicXML.xml -o musicXML.png

Example :

"standard values" good enough to display a score on a standard screen
millimeters = 7 , tenth = 40 , resolution_dpi = 100

to have a score in a square 800x800 pixel :
size_pixel = 800 pixel

size_tenth = ((800*25.4)/100)*(40/7) = 1161 tenths

in the musixXML.xml file :

 <scaling>
  <millimeters>7</millimeters>
  <tenths>40<tenths>
 </scaling>
 <page-layout>
  <page-height>1161<page-height>
  <page-width>1161<page-width>
  <page-margins>
   <xx-margin>10</xx-margin>
   ... ( for all the margins )
  </page-margins>
 </page-layout>

The MuseScore command line to generate the png 800x800 pixels :
MuseScore.exe -s -m -r 100 musicXML.xml -o musicXML.png


Comments

In reply to by Frank Revolle

Workaround on Mac. In a script :
curScore.pageFormat.evenBottomMargin = margin ; // will be replaced with the margin in inch
curScore.pageFormat.evenLeftMargin = margin ;
curScore.pageFormat.evenTopMargin = margin ;
curScore.pageFormat.oddBottomMargin = margin ;
curScore.pageFormat.oddLeftMargin = margin ;
curScore.pageFormat.oddTopMargin = margin ;
curScore.pageFormat.size.width = width ; // will be replaced with the width in inch
curScore.pageFormat.size.height = height ; // will be replaced with the height in inch
curScore.pageFormat.printableWidth = pwidth ;// will be replaced with the printable width in inch
curScore.doLayout();

Do you still have an unanswered question? Please log in first to post your question.