11

In Lilypond the paper size can be set to A4, A5, Letter and so forth. However I have only a short song, and I want to embed it lateron. Therefore the output from Lilypond must be cropped somehow.

Is there a possibility to let Lilypond itself do this? Some setting to the \paper{} block, perhaps?

4 Answers 4

10
+100
  • If you want only the first system, you can use the -dpreview command-line option.
  • If you want multiple systems:

    \include "lilypond-book-preamble.ly"

    \paper { oddFooterMarkup = ##f }

  • Have ImageMagick convert autocrop it with the -trim option, e.g. via a shell script.

2
  • Newbie question: What's a system in lilypond terms? Oct 21, 2019 at 0:32
  • 1
    "System" is a musical term, not a lilypond term. The first system the first "line" of notes.
    – schoettl
    Nov 25, 2020 at 20:06
4

I managed this with running:

lilypond -dbackend=eps -dresolution=600 --png FILE.ly

And a paper section within the FILE.ly like this:

\paper {
  indent = 0\mm
  line-width = 110\mm
  oddHeaderMarkup = ""
  evenHeaderMarkup = ""
  oddFooterMarkup = ""
  evenFooterMarkup = ""
}
1
  • Worked perfectly for me, with the great advantage that no third party package is necessary. I've created a croped-paper.ly definition and included it.
    – neves
    Sep 5, 2014 at 3:03
2

I know this is twelve years old now, but it still comes up on google. Add this line to the top of the lilypond file...

#(ly:set-option 'crop #t)

It will produce another file called filename.cropped.pdf, or svg, or png, whatever you have it set to.

1
  • Cool! Thank you very much! I re-visit this question about once a year, because I still haven’t found a good solution. But this is great! I can even use it trivially simple on the command line with the -dcrop flag.
    – Boldewyn
    Apr 23, 2022 at 22:20
0

From the Lilypond manual:

Extra sizes may be added by editing the definition for paper-alist in the initialization file scm/paper.scm.

You can therefore add your own page sizes to the default ones.

1
  • 2
    Yes, I read that, too, but actually I have several songs, and doing trial-and-error with each to find the correct height and then editing paper.scm for each is a bit of a hassle. Auto-cropping to the minimum width/height would be much, much more useful.
    – Boldewyn
    Jan 18, 2010 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .