On 04/10/2010 09:36 PM, Patrick McCarty wrote:
On Sat, Apr 10, 2010 at 8:24 PM, Jonathan Wilkes<jancs...@yahoo.com>  wrote:
Hello,
     I was curious if the transparent background for png output ever
got implemented.  I'm using little lilypond excerpts for a webpage I just
started working on, and the background is a light-grey gradient.

The GIMP solution mentioned earlier in the thread works just fine, but if
it's possible to get the transparency through Lilypond, that would save a
step.

Also, if it's not implemented and someone has the chops to implement it,
(and wouldn't mind implementing it), I can put some money toward it.

You could send a feature request to the bug-lilypond mailing list.

I might be interested in implementing this eventually, but there is a
chance I'll forget unless it is on the bug tracker.

Thanks,
Patrick
I used to use Gimp to get the transparent alpha channel. For the last six months, I've been using these little scripts (Imagemagick in Linux) to get the same result. It performs the action on the pdf file generated by Lilypond. I'm sure with some tweaking it can work in Windows as well.

For a single page file...

#!/bin/bash
for i in `ls *.pdf`; do convert "$i" -density 90x90 -crop 1024x768+0+0\! +repage -transparent white "$i".png;
rm *.ly~
done

For a multipage file...

#!/bin/bash
for i in `ls *.pdf`; do convert "$i" -density 90x90 -crop 1024x768+0+0\! +repage -transparent white "$i".png; ls *.pdf-*.png | perl -e 'foreach (<stdin>) {print $_ . " $1-".($2+1).".png\n" if (/(.*)\.pdf-(\d+).png/)}'|xargs -n2 mv ;
rm *.ly~
done

The multipage script also does a little number conversion trick. Imagemagick starts with page number "0" as part of the file name. The script changes this to begin with number "1" and up, which helps in situationa like inserting image files into a powerpoint presentation.

This isn't the built-in solution you're looking for in Lilypond, but it's much faster than manually making the change in Gimp. These dimensions (1024X768) work well with page dimensions I define in scheme.

        #(define paper-width ( * 1030 pt))
        #(define line-width ( * 930 pt))
        #(define page-height ( * 558 pt))
but require a large staff size to display well. It works for me, but your own mileage may vary. Just to give credit where due, I got help putting these together on the Arch Linux forums.

Stephen Corey
Roseville, California






_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to