[l2h] Re: Background color of graphics in l2h

Ross Moore Ross Moore <ross@ics.mq.edu.au>
Tue, 10 Oct 2000 14:12:13 +1100 (EST)


> I've always wondered the same but wasn't going to research it. I figured that 
> there was a posting or a faq somewhere where this has been addressed already. 
>  If so I'm interested in finding out.

Here is the full situation:


Matching the background of the HTML pages to the background of your images 
is impossible to achieve always, since your readers can choose whatever default
background colour they wish.

To overcome this, you must specify a background color for your pages
as well as for your images. The easiest way to do this consistently
is to have LaTeX code in the document preamble:

  \usepackage{color}
  \pagecolor{<color>}

e.g.  <color> = 'white'  is the most common.

Note that when processing documents with LaTeX, people tend to
think that the background will be white, unless specified otherwise.
That is not true. The background is 'transparent'; they just tend
to print on white paper. (More on transparency below.)

The default background colour in most Web browsers is 'gray'.
LaTeX2HTML defaults the background color to gray, to match this
(even though, nowadays, white is perhaps seen more often as a background,
at least in commercially-constructed web-sites).

There is a second reason for choosing 'gray' as the background colour,
at least for images of pieces of text; e.g. accented letters,
and mathematical symbols that do not appear in standard fonts.
This is related to anti-aliasing effects.


 *** Transparent backgrounds for images ***.

Having the background to an image as transparent completely solves
the problem of matching the image background to the page-colour.
When LaTeX2HTML is installed, it is usually with the setting to
create images with transparent backgrounds --- provided software to
do so is available on the local system.

Both the GIF and PNG graphics formats support specifying
that a particular colour should be shown as transparent.

GIF, which has been around a lot longer, is well supported in most
browsers, including support for the transparent color.

PNG is not yet fully support in the most popular browsers;
so although you can specify a transparent colour, the browser may not
render it transparently. Instead the actual colour is shown.


Thus it is desirable to produce .gif images ?

Well, that depends on your attitude to the licensing/legality issues.
Consult the following pages to get both sides to the controversy,
and make up your own mind:

	http://burnallgifs.org/
	http://www.unisys.com/unisys/lzw/default.asp

The long and short of it is that if all browsers were to completely support the
free PNG standard, then there would be no need to use the GIF format any more.
This may well happen  --- but who knows when ?

Even then, it would be 3-4 years before it would be reasonable to assume that
older versions of the browsers were no longer being used by many people.
At this time, LaTeX2HTML would no longer include code for facilitating
the production of images in GIF format.


 *** Anti-aliasing ***

Anti-aliasing is the  name given to the technique used to "soften the edges"
of a low-resolution bitmapped image, resulting in a smoother/cleaner appearance
e.g. to the shapes of character glyphs.

This is very important for LaTeX2HTML, in which images are created typically as 
bitmaps at a resolution of 75dpi. Typically the fonts are provided at 600dpi,
or as outlines which need to be filled. Clearly some averaging is needed,
and the colour of the background has a profound effect on the results obtained.
Experiments have shown that it is slightly better to anti-alias black characters
against a gray-level of between 20% to 35%, rather than against pure white; i.e. 0%.

The figure actually chosen for LaTeX2HTML is a matter of personal taste;
it can be adjusted with the Perl variable: $LATEX_COLOR .

 

Hope this helps,

	Ross Moore