Josh Nichols wrote:
I want to be able to generate graphic musical examples without getting
it formatted on a giant paper-formatted .pdf or .png. How do I
accomplish this?
I cannot find anything in the manual which allows this.
I assume you basically want to trim your output to the really used space.
I guess there should be an option to do so, since it's done for the
snippets in the documentation, and it might well be the clip-systems
option. However, this one does exactly nothing for me (2.12.1), or I
just can't use it correctly.
If you have ImageMagick ready, for PNGs you can just call
convert -trim original.png trimmed.png
If you want trimmed PDF and/or EPS files and are on one of the common
Unices with ImageMagick/GraphicsMagick, GhostScript and xpdf-utils
installed, have a look at the attached Makefile.
Note that I don't simply use the above command for the PNGs, but convert
the PDF to PNG instead; this way, the sizes of both images are exactly
the same (up to the resolution).
If you remove the -l option from the ps2eps call in line 16, the PDF
should be trimmed tight; with it, there is a white border of about 1pt
around it.
I have no idea what this does to multipage files, by the way.
HTH,
Alexander
TARGETS=halleluja
RESOLUTION=600
GS=gs -q -dNOPAUSE -dBATCH
.PHONY: all clean
all:$(addsuffix .pdf,$(TARGETS)) \
$(addsuffix -trimmed.pdf,$(TARGETS)) \
$(addsuffix -trimmed.png,$(TARGETS)) \
$(addsuffix -trimmed-no-bg.png,$(TARGETS))
%-trimmed.pdf: %.pdf
cp -f $ $@;
pdftops $@;
rm -f $*-trimmed.eps;
ps2eps -l $*-trimmed.ps;
epstopdf $*-trimmed.eps;
rm -f $*-trimmed.ps;
%.pdf: %.ly
lilypond $;
%-trimmed.png: %-trimmed.pdf
convert -density $(RESOLUTION)x$(RESOLUTION) -units PixelsPerInch
-colorspace Gray -depth 8 $ $@;
%-trimmed-no-bg.png:%-trimmed.png
convert -channel R $ -channel A -size 1x256 gradient:black-none -clut
$@;
%.png: %.ly
lilypond -dresolution=$(RESOLUTION) --png $;
clean: $(addsuffix .CLEAN,$(TARGETS))
%.CLEAN:
rm -f $*-fixed.ps $*-fixed.eps $*.bbox;
rm -f $*.ps $*.pdf $*.png $*-trimmed.eps $*-trimmed.pdf $*-trimmed.png
$*-trimmed-no-bg.png $*.midi;
___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user