Take the 2-minute tour ×
Musical Practice & Performance Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It's 100% free, no registration required.

My question concerns the creation of images using lilypond. Until know I've created some music sheets and lilypond has been really great. However I have a website and I would like to post some examples to illustrate what I'm saying. The images should just fit the size of what is written. It will mostly been 2-3 bars max, but I would like the size to fit automatically as it could be bigger.

When I use the --png option, it creates an image the size of an A4 page. I tried using the snippets shown in the doc, for exemple here : http://lilypond.org/doc/v2.12/input/lsr/12/lily-1ed76b9d.ly

If I comment the \include "lilypond-book-preamble.ly", then it shows as an A4 document. If I leave it, then I'm asked to add -dbackend=eps to the command line. If I add it, then it actually produces the result i'm searching for. However it also adds a whole bunch of files (multiple .pdf, .eps, .tex, .texi, .count).

Is there a proper way to do it, or should I write a bash script to clean the folder after the lilypond command?

Another thing: with the --png option, are we able to define an image size? I'm able to change it using -dresolution but it's not very handy as you have to try to see the output size, then change and try again... Maybe is it better to create .pdf and use other scripts to convert into .png?

Thank you in advance! I searched for this information but found very little about it so far...

share|improve this question
1  
Note that your link is to the documentation for the v2.12 version of the software. You may want to consider using a newer version, or looking at the documentation for the version that you are using. –  Dave Feb 17 at 20:18
    
Note that cross posting the same question on multiple sites is frowned upon, c.f. (meta.stackexchange.com/questions/64068/…) –  Dave Feb 17 at 20:21
    
Sorry, i'm new here. I read several posts that said lilypond questions could belong in both, not that it was limited to one. Won't happen again. I also updated my lilypond version (the one in the depository is deprecated). –  Fnor Feb 18 at 1:59

1 Answer 1

I use the following as my header (since version 2.16):

\paper{
    indent=0\mm
    line-width=120\mm
    oddFooterMarkup=##f
    oddHeaderMarkup=##f
    bookTitleMarkup = ##f
    scoreTitleMarkup = ##f
    }
    \relative c' { c4 d e f | g a b c }

and compile it using lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png test.ly. The resulting png files fit to the music. This does produce the extraneous (mostly TeX related) files; I do not know of a way around that.

share|improve this answer
    
Thanks, this gives me the expected result! However it also gives a lot of files I won't use (.eps, .tex, ...). Is there a way to handle it with lilypond or am I better off using rm? –  Fnor Feb 18 at 2:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.