7

I would like to render formulae in PNG format for use in various websites. The problem is, every rendering tool I've come across seems to assume a particular background color to perform anti-aliasing, resulting in nasty color fringes when the image is displayed on a different background color. Is there a way to perform the anti-aliasing in the alpha-channel so that the equation will look nice and crisp no matter what color the background it'll be displayed on is?

Or is it not possible?

yo'
  • 51,322
Thomas
  • 213
  • 1
    One solution is to render in high resolution, and then change white to transparent and then reduce the size, properly mixing black and transparent. I'm sure ImageMagick's convert is capable of it. – yo' Nov 19 '12 at 07:22
  • There are a number of online equation compilers listed at http://tex.stackexchange.com/a/1654/4012, in case one of these helps. – doncherry Nov 19 '12 at 07:31
  • @tohecz Thanks, that sounds like a good suggestion. Right now I've been doing it by rendering to SVG, then to a large transparent PNG, but it's rather long-winded - I will try your method. – Thomas Nov 19 '12 at 07:31
  • You don't say how you create your pngs. dvipng has an option for setting the background colour to transparent: -bg Transparent. I expect GhostScript to have a similar option. – Martin Schröder Nov 19 '12 at 07:56
  • I'm afraid that this does not look on-topic for us. I can see the link to TeX, but really expertise in TeX will not directly help in an answer. Perhaps migration to SuperUser would be appropriate. – Joseph Wright Nov 19 '12 at 08:22
  • @JosephWright I don't 100% agree. There can be a solution in LaTeX. (Maybe in future versions of standalone ?) – yo' Nov 19 '12 at 08:31
  • @tohecz As the question stands, there is no mention of how the .png files are produced. Also, all standalone can do is call some external tool for post-production modification of a DVI or PDF. As such, TeX is not involved in the conversion. A good answer for the question as posed seems to me to be about tools for creating .png files. – Joseph Wright Nov 19 '12 at 08:34
  • @JosephWright I somehow agree. As well, Thomas: you seem to solve your issue since your avatar has changed from white to transparent background. So please, if you don't need any help, we will close this as off-topic (since it even doesn't mention TeX at all), or improve your question to show what help you need from the TeX side of thing. – yo' Nov 19 '12 at 08:48
  • I solved it using the ugly way I mentioned above but your method worked tohecz - if you could post it as an answer I could accept it before the question gets closed. – Thomas Nov 19 '12 at 08:55

1 Answers1

2

There's a possibility to use ImageMagick's convert: you first generate a hi-res image, then you change white to transparent, and finally you scale the image down.

yo'
  • 51,322