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...