I wrote earlier about the bug in which Lilypond with the eps backend
inaccurately calculates the bounding box, and Andrea provided a
working solution (thank you).

I turned it into this Bash script, which works well for me, though I
don't understand why this process should be necessary.

Intriguingly, when I run this script it produces a cropped PDF image
which is about 10% the size of the PDF produced just by compiling with
lilypond alone.

In one example the full-page lilypond PDF, a single page with one
system of music, was 160K; the PDF produced by "lilycrop" was 19K!

****

~/bin/lilycrop:

#! /bin/sh
set -e

file="${1%.ly}"

lilypond "$file"
pdftops -eps "$file".pdf
cat "$file".eps | ps2eps > "$file"_cut.eps
epstopdf "$file"_cut.eps
rm "$file".eps "$file"_cut.eps
mv "$file"_cut.pdf "$file".pdf
echo "Cropped PDF '$file.pdf' produced from '$1'"

***

Andrew Cashner

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to