Index of /mirrors/

[ICO]NameLast modifiedSize
[PARENTDIR]Parent Directory  -
[   ]ALL.tar.Z1996-12-16 23:29 812K
[TXT]README.html1996-09-04 15:44 8.9K
[   ]cjpeg.Z1996-12-16 23:26 51K
[   ]conimg.Z1996-09-04 14:41 20K
[   ]cutimg.Z1996-09-04 14:41 15K
[   ]enhance.Z1996-09-04 14:41 175K
[   ]epstogif.Z1995-03-21 23:39 187
[   ]fromeps.Z1996-09-04 14:41 69K
[   ]fromgif.Z1996-09-04 14:41 17K
[   ]fromps.Z1996-09-04 14:41 29K
[   ]gifinter.Z1996-09-04 14:41 12K
[   ]gifspace.Z1994-10-11 10:27 145
[   ]gifstat.Z1996-09-04 14:41 9.0K
[   ]iflip.Z1996-09-04 14:41 21K
[   ]ipaste.Z1996-09-04 14:41 45K
[   ]iv.Z1996-09-04 14:41 149K
[   ]izoom.Z1996-09-04 14:41 33K
[   ]mkpal.Z1996-09-04 14:41 26K
[   ]scope.Z1996-09-04 14:41 38K
[   ]subimg.Z1996-09-04 14:41 10K
[   ]togif.Z1996-09-04 14:41 97K
[   ]tojpg.Z1996-09-19 23:28 162
[   ]trans128.Z1996-09-04 14:41 10K
[   ]unframe.Z1996-09-04 14:41 10K
Image Production for Mosaic

Image Production for Mosaic

Paul Haeberli

Oct 1994

Horiz Bar


Generating good looking images for HTML documents can be made a little less unpleasant by using some of the tools and techniques described here.

Making "xv" Work (Better) for You

The program "xv" can be pretty handy for displaying a .jpg, .gif, or .rgb image. Unfortunately, by default, "xv" uses X colormaps to display an image and dithers the image onto the display. This can sometimes create problems, because "xv" is fighting with xmosaic for color map entries. If your machine supports a 24 bit visual in X, the best solution is to add the following lines to your ~/.mailcap file, and restart xmosaic:
    image/jpeg; xv %s -24 -visual truecolor
    image/jpg;  xv %s -24 -visual truecolor
    image/tiff; xv %s -24 -visual truecolor
    image/rgb;  xv %s -24 -visual truecolor
    image/gif;  xv %s -24 -visual truecolor
If you don't have a ~/.mailcap file, create one with this stuff in it.

An Alternative to "xv"

There are some licensing issues with "xv" that make it difficult to distribute. I have developed a simple display application called "iv" that will display JPEG, GIF, TIFF and SGI format images. To make xmosaic use this viewer for images, add the following line to your ~/.mailcap file, and restart xmosaic:
    image/jpeg; iv %s -f
    image/jpg;  iv %s -f
    image/tiff; iv %s -f
    image/rgb;  iv %s -f
    image/gif;  iv %s -f
If you don't have a ~/.mailcap file, create one with this stuff in it.

Enhancing IRIS Images

"enhance" is a program that lets you easily control the brightness, shadow detail, saturation, and sharpness, of your images. But before you start any major image hacking, first make sure your monitor is adjusted properly. To do this run "gamcal":
    % gamcal
Look at the vertical grey bands of color going from full brightness on the left to pure black on the right. Make sure you can see the steps in brightness from each bar to the next. Adjust the monitor brightness so you can just barely see the transition from complete black on the far right, to the bar just to the left, which has a brightness of 1/255.

Now, to enhance an input input run "enhance" like this:

   % enhance in.rgb out.rgb
The program lets you select an image processing operation from a list, and will display a set of 9 images for you to choose from. Each time you make a choice, the process is applied to a small copy of your input image. When you've got the small image looking the way you want, press the "Write Output" button and the output file will be created.

Converting IRIS Images to JPEG Format

If you want to convert an SGI image to jpeg format This command will do the job:
    % cjpeg -q 30 < pic.rgb  > pic.jpg
The number 30 specifies a quality factor. This number can be any value between 0 and 100. The bigger the quality factor is, the higher the quality of the resulting JPEG image. Remember though, that higher quality images will consume more bytes, and therefore take longer to transfer.

Page Width Issues

When our current xmosaic viewer starts up, the document area is 564 pixels across. For html pages to be displayed through WIRED's HotWired service the maximum width of the document area is 476 pixels.

If custom horizontal rules are used they probably should be made exactly 564 (476) pixels wide. Its also probably good to make sure that no images are wider than 564 (476) pixels. What a jooooke.

Using Showcase for Design

Showcase can be a handy tool for combining graphics with images. It can also be used to add labels to RGB images, or to combine a series of images together. To convert a Showcase illustration into a GIF image, here are the steps: 1. Save the illustration in EPS format using the "Save As.." menu. 2. Convert the .eps file to a .gif file using the script "epstogif". % epstogif picture.eps picture.gif

The script "epstogif" uses a resolution of 66.3 pixels/inch for rendering EPS files. This value is used so that a picture that is 8.5 inches wide will end up exactly 564 pixels across. If you want to change this scale factor, you can make a new script based on the epstogif script in /usr/sbin/epstogif.

When an EPS file is converted, it is made into a GIF image with 64 or fewer colors. If you would like it to use fewer colors for the final GIF image, you make a new version of epstogif with different options for "togif".

Using Adobe Illustrator

The process described above can be used to convert graphics designed with Adobe Illustrator into GIF images. Just save the file in EPS format, transfer it to an IRIS and run the "epstogif" script.


This describes some of the internal stuff that "epstogif" does to convert an EPS file into a GIF image with transparency. You may want to study this if you want additional control in how EPS files get converted to GIF images.

First a program called "fromeps" is used to convert the EPS file into an RGB IRIS image. To use this:

    % fromeps graphic.eps out.rgba -a -f -p 96
The -a option is to output an rgba file instead of rgb.
The -f option forces full page rendering.
The -p option specifies the resolution in pixels per inch.

You can use the program "unframe" to remove any extra white space around the image like this:

    % unframe out.rgba trimmed.rgba
Now the file trimmed.rgba will be an IRIS image file with an alpha channel that sez what parts are transparent. The next step is to make all the transparent parts be a perfect grey of 128,128,128, so "togif" will know which parts to make transparent:
    % trans128 trimmed.rgba trimmed.rgb
The last step is to run "togif" to actually convert the RGB image into a GIF file.
    % togif trimmed.rgb graphic.gif -x 128 128 128 -n 64
The -x option specifies an RGB color in the input image. that indicates transparent pixels.
the -n option specifies the maximum number of colors to use in the GIF image.

In this case togif will generate an optimal palette of colors, and dither the input RGB image to make a GIF image.


If you would like to specify your own color map for "togif" to use, you can do it with a "-m" option. This will be useful if you have many small images on a page, and you want the whole page to look as good as possible.
    % togif in.rgb out.gif -m -x 128 128 128 -n 64
The file can be generated from a group of RGB image files with the "mkpal" program:
    % mkpal 128 in1.rgb in2.rgb in3.rgb
This will make a palette of 128 colors tuned to display all these input RGB images.

Centering Images

Unfortunately, the current version of HTML does not support displaying images centered on the page. This may change in the future. However in the mean time, if you know the width of the viewer people are using, you can center images by using an invisible (transparent) image. There is a script called "gifspace" that will make a perfectly invisible image of a specific size.

To make a little horizontal spacer do:

    % gifspace xspace100.gif 100 1
To make a vertical space do:
    % gifspace yspace30.gif 1 30
This can be used to center an image in the default page. These spacing .gif files are teeny - a 100 pixel wide image is 49 bytes.

This will work until the next generation of HTML becomes widely available.

Getting Information About a GIF File

You can use the program "gifstat" to print information about the size of GIF images and also how many colors they use:
    % gifstat this.gif that.gif theother.gif

How to Get the Programs

ftp to Login as anonymous, use your email address as the password. cd graphics/mostools. Set binary mode on. Set prompt, get all the file ALL.tar.Z uncompress ALL.tar.Z. Next do tar xvf ALL.tar. Then copy all the programs into /usr/sbin. Finally type rehash.

NOTE: To run fromps, fromeps and epstogif you will need Impressario software from SGI. To order a copy, call 1-800-7441, then install

NOTE: To avoid confusion you should probably make sure you don't have old copies of these programs in /usr/local/bin or elsewhere.