Yenya's World

Mon, 15 Jan 2007

PNG Transparency

In electronic tests in IS MU we use images for displaying mathematics (as MathML is still not widely supported by browsers). We have recently moved this system from mimeTeX to the native TeX-based system (with dvipng as a back-end), which provides the TeX syntax, including possible additional macros such as AMSLaTeX. However, the PNG files generated by dvipng have problems in MS Internet Exporer with transparency.

equation image

(the above picture will not be easily visible in MSIE 5.5 and 6). The older (and not-so-old) versions of MSIE display only 100% opaque pixels in the PNG images, so thin (and thus partly transparent) lines in mathematics are often not displayed at all - see the following MSIE 6 screenshot:

MSIE
transparency screenshot

One of the solutions is to change the full alpha transparency to the binary (fully transparent/fully opaque) transparency, but this looks bad when the image background is somehting other than the default. There are various hacks to enable transparency in MSIE 5.5 and 6, but none of them worked for me. After more-than-expected amount of time spent by experiments, I have found that dvipng generates 4-bit PNG images with palette, while MSIE can handle (even with this hack) only static color images. Another strange problem solved - use the "--truecolor" switch to dvipng.

Section: /computers (RSS feed) | Permanent link | 3 writebacks

3 replies for this story:

Vasek Stodulka wrote:

If everything is grayscale, you should convert it to GIFs. I think GIF supports only binary alpha, but it is supported in all versions of MSIE quite well.

Yenya wrote: binary alpha

PNG (and dvipng) supports binary alpha as well, the problem is that full alpha looks much better.

Stepan wrote: use IE7 :(

We had the same problem on avivaz.cz. Unfortunately, we did not find solution...

Reply to this story:

 
Name:
URL/Email: [http://... or mailto:you@wherever] (optional)
Title: (optional)
Comments:
Key image: key image (valid for an hour only)
Key value: (to verify you are not a bot)

About:

Yenya's World: Linux and beyond - Yenya's blog.

Links:

RSS feed

Jan "Yenya" Kasprzak

The main page of this blog

Categories:

Archive:

Blog roll:

alphabetically :-)