Image2HTML:
Conversion of GIF and JPEG files to HTML tables
<TABLE>
Overview
FAQ Download Use It Online!
This site uses no graphical image files (except the banner)

That's right, neither this page, nor any page in the Image2HTML pages, contain any GIF, JPEG, or any other kind of image file, except for the Sawmill advertisement graphic. So how did we do the graphics at the top and bottom of this page? Read on....

Image2HTML Overview

Image2HTML is a program, written in Java, which converts a bitmap image (like a JPEG or a GIF) into an HTML table. The resulting table is constructed very precisely, to ensure that it looks exactly like the original image. Essentially, it creates a table with a separate 1x1 table cell for each pixel in the original image, and sets the color of that cell to the same color as the corresponding image. A compression mechanism can be used to combine adjacent pixels of the same color into a single table cell. All images on this page are done in this manner, including this divider:

Why would I want to use it?

Since images created with Image2HTML are part of the HTML page itself, they are loaded when the page text loads. This has the advantage of requiring only a single network access to get the text of the page and the image, rather than the two network accesses usually required (the first to get the HTML text of the page, and the second to get the image).

Images created with Image2HTML might also possibly be useful to people writing programs which generate HTML, but which cannot for some reason include inlined images (this is often the case for CGI programs, which may not know where the server directory is, or may not be able to access it). Such programs can include simple images in their output using the images generated by Image2HTML.

As an added benefit, Image2HTML provides a primitive form of "copy protection" for images, since they cannot be right-clicked to download them in the standard manner (thanks to Douglas Wood for pointing that out).

Finally, images created with Image2HTML will appear even when images have been turned off in the browser (or mail client). So if you want your image to show up regardless of the settings of the visitor's web browser or mail client, Image2HTML provides a way to do it. This can be a significant benefit for HTML-encoded email, since many mail clients do not show externally linked images by default (thanks to Miles Moulding for pointing out the value in HTML email).

Before you get excited...?

For most purposes, Image2HTML is not a practical solution. It was primarily designed just to show it could be done. Here's why it it not usually practical:

  • Each pixel in the original image (which occupies a single byte in GIF file, or three bytes in JPEG files, ignoring compression) is translated by this process into a chunk of HTML which is about 100 characters long. This means that ignoring compression, the resulting image will be at least 100 times larger than the original. GIF and JPEG compression widen this gap, and Image2HTML's compression feature narrows it, but it will always be substantial, except perhaps for very simple, blocky images.

  • Browsers do a surprisingly good job rendering the tables which Image2HTML generates, but they can take a very long time and a huge amount of memory to do so. For photographic images in the 400x400 range, it can take hundreds of megabytes of memory, and hours of time, just to display them in a browser.

So what's the point of it?

Image2HTML is a Cool Computer Trick. Many people are amazed to find that any image can be represented as an HTML table; we feel that Image2HTML's coolness factor is enough to justify its existence. For those wanting to use it for practical purposes, it may be useful in the situations outlined above, provided it is used on simple, small, or blocky images. This page is a good example; because we used only a few small images, and one larger blocky one, the total size of this page is under 20k (and it loads no additional image files). Experiment with the online version to find out more about what it can do.

Image2HTML was created and is brought to you by Greg Ferrar and Ken Brownfield