Op maandag 25 augustus 2008, schreef Gilles Sadowski:
>  $ convert test.png -transparent white test_tr.png

This will convert 'white' to '100% transparent', but not the shades of grey 
created by the anti-aliasing algorithms in ghostscript.

After long fiddling I found a way to convert every shade of grey to black with 
a corresponding percentage of transparency:

convert input.png \
        -trim -bordercolor white -border 3 \
        \( +clone -threshold 100% \) \
        \( -clone 0 -negate \) \
        -delete 0 -compose CopyOpacity -composite +repage output.png

- the first line crops the image and adds a border of 3 pixels
- the second and third line create to new images, one just black, the other 
with the colors negated.
- the last line deletes the first (original) image and copy the negated image 
to the alpha channel of a fully black image.

I use this to create LilyPond symbols for the menu actions in LilyKDE :-)

best regards,
Wilbert Berendsen

-- 
LilyKDE, LilyPond for KDE: http://lilykde.googlecode.com/


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

Reply via email to