Lilypond Output in Different Formats

August 14, 2010

Here's how to output your lilypond scores in different formats. These all assume we start off with a which, for example, contains:

  \version "2.10.0"
    \time 4/4
    \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(-6 . 7)
    \override Staff.TimeSignature #'style = #'()
    \clef bass
    e e e r e r e r r e e r e e e r \bar "|."


To get a PDF file, simply invoke the lilypond command:

$ lilypond


To get SVG, we need to specify a different backend:

$ lilypond -dbackend=svg


Similar to SVG, we can specify a backend to get an EPS file:

$ lilypond -dbackend=eps


Once we have an eps file, we can use image magick to convert it into a jpg

$ lilypond -dbackend=eps
$ convert -density 1000x1000 file.eps file.jpg

Cropping JPG

I also want to crop the JPG so that I remove the lilypond text footer, and then trim it to remove the excess whitespace. This can probably be done within lilypond, but it's easier for me to do it direct on the JPG. This can be done using:

$ convert -crop x7000 file.jpg
$ convert -trim file-crop.0.jpg file-trim.jpg
$ convert -resize 13% file-trim.jpg file-web.jpg

Tags: lilypond