|
|||||||||
|
Images on transparent backgroundsA company or institution's logo is often displayed at the top of documents. There is no difficulty in doing this, but if you want the logo to blend in with the rest of the document, the background colour of the logo should match that of the document. The document background colour varies according to the browser and can often be changed by the user, so you will need to specify a transparent background colour. Transparent backgrounds are a feature of GIF89a and subsequent versions only. The following example illustrates the effect of making the background of an image transparent:
(Images courtesy of Silicon Graphics Computer Systems, Inc.) There are a number of ways of creating a GIF image with a transparent background. The PBM utilities contain a number of programs for converting images from one format to another. The ppmtogif program will convert a file from PBM or PPM format to GIF format, allowing a transparent colour to be specified. The giftrans program will convert a GIF87 file to a GIF89a file. A background colour that will be designated as transparent must be specified. This colour should not be used anywhere else in the image and it is best to make the colour light grey, for the benefit of browsers that do not support transparent GIFs. Under UNIX the XV program can be used to determine the colour of a pixel by clicking on it, which causes the colour value to be displayed as a triplet of decimal numbers, indicating the intensities of the red, green and blue components. This colour can then be specified to giftrans or ppmtogif as the colour of the transparent background. These programs require the colour to be specified as an X Window System colour specification, which is a hexadecimal string or a colour name. You therefore need to convert the decimal values. For example, if you have an image that has a light grey background, represented by XV as the decimal triplet (192,192,192), convert the decimal numbers to hexadecimal (using your memory, a calculator or a table). In this case 192 is hexadecimal C0. Type in either of the following UNIX command lines to make the background transparent:
giftrans -t '#C0C0C0' image.ppm >new-image.gif or:
giftoppm image.gif >image.ppm ppmtogif -trans #C0C0C0 image.ppm >image.gif Some commercial graphics packages will allow you to do this interactively.
Next: Spacing between images Up: Tips and techniques Previous: Tips and techniques
Spinning the Web by Andrew Ford |
||||||
Copyright © 1996-2002 Ford & Mason Ltd |