lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lots of temporary files when generating png files


From: Aaron Hill
Subject: Re: Lots of temporary files when generating png files
Date: Tue, 04 Feb 2020 08:57:42 -0800
User-agent: Roundcube Webmail/1.4.2

On 2020-02-04 7:59 am, Anthony Rushforth wrote:
@Aaron : Because if I use your command line I get this png : a full page

I want a cropped png, and I found the command line I use in the
documentation (
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#lilypond-output-in-other-programs)
:

To produce ‘PNG’ images;

lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png myfile.ly


I don't understand why it has to be "eps", but it's the only way I found...
do you have another option to get cropped images ?

Two options: (1) fix your \paper settings, or (2) use the crop feature of LilyPond.

Regarding the first option, the idea is to set up your \paper properly so that the output from LilyPond is what you want. My use case involves outputting transparent PNGs for use in projection. I have my paper size configured to match the slides, and I have adjusted staff and font sizes accordingly to try to maintain good readability. In this way, the output from LilyPond is nearly perfect for dropping into a presentation. I only need to use ImageMagick for a little post-processing, which does include cropping transparent pixels, since some slides are not as "full" as others. For reference, here is an excerpt from my build script showing the IM command-line:

####
./imagemagick/magick convert $file -trim +repage \
  -filter Spline -define filter:blur=0.707 \
  -distort Resize 50% -density 56.69 PNG32:$file
####


Regarding the second option, LilyPond provides a built-in form of cropping. The amended command-line would look as follows:

####
lilypond \
  -dcrop -dno-print-pages \
  -dresolution=288 \
  -dpixmap-format=pngalpha \
  --png \
  source.ly
####

Note that -dno-print-pages is used to suppress the normal output.

I went the IM route because -dcrop does change how LilyPond handles vertical spacing. Depending on your needs, you might find -dcrop works well enough.


-- Aaron Hill

Attachment: c1c1e1g1.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]