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.
(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:
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
.