I tried posting this on the ImageMagick Studio forum,
but I didn't get any responses.  I'm hoping to have
better luck here.  My apologies to those who are
seeing this for the second time.

I'm trying to make some images of equations I have
written in LaTeX, using my Linux system.  I want the
equations to be a with black text on a transparent
background. I originally tried a program called eqe
(that apparently uses ImageMagick internally), but I
found that if I tried producing a PNG of black text on
a transparent background, it appeared to have
white-ish bits at the edges of the text if placed on a
dark background.  I gather that this is due to
anti-aliasing.

What I'm currently trying to do is use the ImageMagick
(6.0.6) command line tool "convert"  in Linux to take
a PNG image of black text on a white background and
produce a PNG of black text on a transparent
background.  If I simply apply the command

convert -transparent white image_in.png image_out.png

I get the same result as with eqe, white-ish bits
around the text.  If I produce an image of the
equation without anti-aliasing, I can convert it
without getting the white bits, but the resulting text
doesn't look very good without the anti-aliasing.  So,
I'd like to have both anti-aliasing and transparency. 


I assume that anti-aliasing sets pixels near the text
to slightly gray values and that "convert -transparent
white" only sets pixels that are completely white to
being transparent.  I'm not very knowledgeable about
image manipulation, but my guess is that I can achieve
a decent looking image with both anti-aliasing and
transparency by applying an operation to the black
text on white background that will set the
transparency of each pixel according to the gray-scale
value, with black being totally opaque and white being
totally transparent.  

convert appears to be quite powerful, and I think it
is possible to do what I want, but I don't quite
understand how.  After reading the man page for
ImageMagick and convert, 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'd take either the
correct way to use -fx to do this or any other tips. 
I must admit  that I couldn't really understand the
usage of the -fx option from the man page.

Thanks,

Nick

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to