##
Figures and Image Conversion

Subsections

- - `\htmlimage{<options>}`
- An Embedded Image Example
- Image Sharing and Recycling
- Quality of Printed Images

LATEX2`HTML` converts equations, special accents, external PostScript files, and LATEX environments it cannot directly translate into inlined images. This section describes how it is possible to control the final appearance of such images. For purposes of discussion ...

- “small images”
  refers to inline math expressions, special accents and any other LATEX command which causes an image to be generated; while ...
- “figures”
  applies to image-generating LATEX environments (e.g. makeimage, figure, table (with `HTML` 2.0), and displayed math environments when required to generate images, etc.).

The size of all “small images” depends on a configuration variable `$MATH_SCALE_FACTOR` which specifies how much to enlarge or reduce them in relation to their original size in the PostScript version of the document. For example a scale-factor of 0.5 will make all images half as big, while a scale-factor of 2 will make them twice as big. Larger scale-factors result in longer processing times and larger intermediate image files. A scale-factor will only be effective if it is greater than 0. The configuration variable `$FIGURE_SCALE_FACTOR` performs a similar function for “figures”. Both of these variables are initially set to have value 1.6.

A further variable `$DISP_SCALE_FACTOR` is used with `displayed math' equations and formulas; this value multiplies the `$MATH_SCALE_FACTOR` to give the actual scaling used. With the improved clarity of anti-aliased images, a scaling of 1.6 may be a little excessive for inline images. Accordingly this manual actually uses values of 1.4 and 1.2 respectively, for `$MATH_SCALE_FACTOR` and `$DISP_SCALE_FACTOR`. These go well with the browser's text-font set at 14 pt. The next larger size of 17 pt is then used for the `<LARGE>` tags in displayed equations.

A further variable `$EXTRA_IMAGE_SCALE` allows images to be created at a larger size than intended for display. The browser itself scales them down to the intended size, but has the extra information available for a better quality print. This feature is also available with single images. It is discussed, with examples, on the next page.

####
`\htmlimage{<options>}`

For finer control, several parameters affecting the conversion of a single image can be controlled with the command `\htmlimage`, which is defined in `html.sty`. With version V97.1 use of this command has been extended to allow it to control whether an image is generated or not for some environments, as well as specifying effects to be used when creating this image.

If an `\htmlimage` command appears within any environment for which creating an image is a possible strategy (though not usual, due to loading of extensions, say), then an image will indeed be created. Any effects requested in the `<options>` argument will be used. Having empty `<options>` still causes the image to be generated.

This ability has been used within this manual, for example with the mathematics images in the previous section.

The `<options>` argument is a string separated by commas.
Allowable options are:

- `scale=<scale-factor>`
  allows control over the size of the final image.

- `external`
  will cause the image not to be inlined; instead it will be accessible via a hyperlink.

- `thumbnail=<scale-factor>`
  will cause a small inlined image to be placed in the caption. The size of the thumbnail depends on the `<scale-factor>`, as a factor of the `natural size' of the image, ignoring any `$FIGURE_SCALE_FACTOR` or `$MATH_SCALE_FACTOR`, etc. which may be applicable to the full-sized version of the image. Use of the ``thumbnail=`' option implies the ``external`' option.

- `map=<server-side image-map URL>`
  specifies that the image is to be made into an active image-map. (See another section for more information.)

- `usemap=<client-side image-map URL>` same as previous item, but with the image-map processed by the client. (See another section for more information.)

- `flip=<flip_option>`
  specifies a change of orientation of the electronic image relative to the printed version. The `<flip_option>` is any single command recognised by the `pnmflip` graphics utility. The most useful of these include:
  - ``rotate90`' or ``r90`' This will rotate the image clockwise by 90`o`.
  - ``rotate270`' or ``r270`' This will rotate the image counterclockwise by 90`o`.
  - ``leftright`' This will flip the image around a vertical axis of rotation.
  - ``topbottom`' This will flip the image around a horizontal axis of rotation.
- `align=<alignment>`
  specifies how the figure will be aligned. The choices are: ``top`', ``bottom`', ``middle`', ``left`', ``right`' and ``center`'.

  The ``middle`' option specifies that the image is to be left-justified in the line, but centered vertically. The ``center`' option specifies that it should also be centered horizontally. This option is valid only if the `HTML` version is `3.0` or higher. The default alignment is ``bottom`'.

- `transparent`, `no_transparent` or `notransparent`
  specify that a transparent background should (not) be used with this image, regardless of the normal behaviour for similar images.

- `antialias`, `no_antialias` or `noantialias`
  specify that anti-aliasing should (not) be used with this image, regardless of the normal behaviour for similar images.

- `extrascale=<scale-factor>`
  is used mainly used with a `<scale-factor>` of 1.5 or 2, when it is important to get printed versions of the completed `HTML` pages. The image is created scaled by the amount specified, but it is embedded in the `HTML` page with attributes to the `<IMG>` of `HEIGHT=...` and `WIDTH=...`, indicating the unscaled size. A browser is supposed to display the image at the requested size by scaling the actual image to fit, effectively imposing its own anti-aliasing. Some examples of this effect are show here. This effect can be applied to all images in a document by setting the `$EXTRA_IMAGE_SCALE` variable. However it may be desirable to also turn off “anti-aliasing”, as these effects serve similar purposes but need not work well together. Furthermore different browsers may give results of different quality. It may be necessary to experiment a little, in order to find the combination that works best at your site.

- `height=<dimen>` and `width=<dimen>`
  are used to specify exactly the size to be occupied by the image on the `HTML` page. The value(s) given this way overrides the natural size of the image and forces the browser to shrink or stretch the image to fit the specified size. The `<dimen>` can be given as either (i) a number (of points); or (ii) with any of the units of cm, mm, in, pt; or (iii) fraction of `\hsize` or `\textwidth`, to become a percentage of the browser window's width, or of `\vsize` or `\textheight` for a percentage height.

  Note: images whose sizes are modified in this way may not be acceptable for image-recycling. Instead they may need to be generated afresh on each run of LATEX2`HTML` through the same source document.

In order to be effective the `\htmlimage` command and its options must be placed inside the environment on which it will operate. Environments for alignment and changing the font size do not generate images of their contents. Any `\htmlimage` command may affect the surrounding environment instead; e.g. within a table or figure environment, but does not apply to a minipage.

When the `\htmlimage` command occurs in an inappropriate place, the following message is printed among the warnings at the end of processing. The actual command is shown, with its argument; also the environment name and identifying number, if there is one.

    The command "\htmlimage" is only effective inside an environment
    which may generate an image (e.g. "{figure}", "{equation}")
     center92: \htmlimage{ ... }