lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating pngs bounded to example size


From: Henning Hraban Ramm
Subject: Re: Creating pngs bounded to example size
Date: Sat, 28 Aug 2010 16:45:30 +0200

Am 2010-08-28 um 16:25 schrieb Mike Solomon:

eeeexactly.  thanks!

Problem with -dpreview is only, that you get just the first line of longer pieces - of course that's intended, but with --png you always get an uncropped PNG.

I resolved it in my LilyPond call script using ImageMagick:

convert $1.png -trim +repage $1.png

But I wanted the background to be transparent, that wasn't really easy:

# see http://www.imagemagick.org/Usage/channels/#trans
convert $1.png \( +clone -fx 'p{0,0}' \) -compose Difference - composite -modulate 100,0 +matte $1_difference.png convert $1_difference.png -bordercolor black -border 5 -threshold 10% - blur 0x0.7 $1_mask.png convert $1.png -bordercolor white -border 5 $1_mask.png +matte - compose CopyOpacity -composite -trim +repage $1.png
rm $1_difference.png $1_mask.png


And for the records, here's my complete LilyPond runner (for MacOS X):

---
#!/bin/bash
LILYAPP="/Applications/music/LilyPond.app"
LILYBIN="/Applications/music/LilyPond 2.13.31.app/Contents/Resources/ bin/lilypond"
# I rename the apps to be able to chose between different versions
if [ -e $1.pdf ]; then
        rm $1.pdf
fi

"$LILYBIN" -dmidi-extension=mid -fpdf -fpng -dresolution=116 -djob- count=3 $1.ly || growlnotify -n LilyPond -a $LILYAPP -d Error -t "LilyPond" -m "$1 failed"
#"$LILYBIN" -dmidi-extension=mid -dbackend=svg -djob-count=3 $1.ly
# -dpreview -dno-include-book-title-preview

if [ -e $1.pdf ]; then
        growlnotify -n LilyPond -a $LILYAPP -d Info -t "LilyPond" -m "$1 ready"
        open $1.pdf
else
growlnotify -n LilyPond -a $LILYAPP -d Error -t "LilyPond" -m "$1 no PDF found"
fi
if [ -e $1.mid ]; then
        open $1.mid
fi
if [ -e $1.ps ]; then
        rm $1.ps
fi
#if [ -e $1.preview.eps ]; then
#       rm $1.preview.eps
#fi
if [ -e $1.png ]; then
        # see http://www.imagemagick.org/Usage/channels/#trans
convert $1.png \( +clone -fx 'p{0,0}' \) -compose Difference - composite -modulate 100,0 +matte $1_difference.png convert $1_difference.png -bordercolor black -border 5 -threshold 10% -blur 0x0.7 $1_mask.png convert $1.png -bordercolor white -border 5 $1_mask.png +matte - compose CopyOpacity -composite -trim +repage $1.png
        #open $1.png
        rm $1_difference.png $1_mask.png
fi
---



Greetlings from Lake Constance
---
fiëé visuëlle
Henning Hraban Ramm
http://www.fiee.net
http://angerweit.tikon.ch/lieder/
https://www.cacert.org (I'm an assurer)





reply via email to

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