I'm trying to make some images of equations I have written in LaTeX. I
want the equations to be clack text on a transparent background. What
I'm currently trying to do is use the ImageMagick command "convert" to
take an image of black text on a white background, and then set the
transparency equal to the brightness on a gray scale (i.e. white is
totally transparent and black is totally opaque). convert appears to be
quite powerful, and I think this is possible, but I don't quite understand
how. Afer reading the man page for ImageMagick, I tried the command
convert -channel alpha -fx 'Transparent*(r+g+b)/3.0' image_in.png image_out.png
but this doesn't seem to do the right thing. Actually, it doesn't seem to
do anything at all. Any tips on how to do what I want? I freely admit
that I find the section on the -fx option to be unclear. Read on if you
want more details on other stuff I tried and the problems with it.
I tried using a nice program called eqe (the Linux equation editor), which
will render images of your latex equations and let you drag and drop them.
The equations from eqe look fine on a solid background, but when you
select a transparent background and then put them over some dark color,
the text has nasty bits of white around the edges. This is apparently due
to anti-aliasing of the text. I think the program originally creates and
image of black text on a white background and then turns all white bits
transparent. However, anti-aliasing causes some bits near the letters to
be gray, rather than entirely white, so they are not transparent at all
and show up as the white-ish bits. I can output perfectly nice black text
on white background, so it would suffice if I could convert these to
trasparent as I asked about above.
I also discovered a script calle get2im that will take LaTeX snippets and
produce images of them. This one has the same issue if antialiasing is
left on, but you can turn antialiasing off and then you can get an
equation on a transparent background with no white stuff. The only
problem here is that it looks a lot worse without the antialiasing. So,
what would be ideal would be antialiasing with transparency, which is what
I was trying to get above.
Thanks for any suggestions.
Nick