Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help

Transparency with GIMP

It's sometimes useful to have images with transparent backgrounds - they stop web-pages looking as if they're full of rectangles and make design more flexible. The JPEG format doesn't support transparent backgrounds but PNG does, and modern browsers render them accurately on screen (though print-outs may be inaccurate). Here are 2 PNG images

They look the same, but against a non-white background the difference becomes clear - the 2nd image doesn't have a white background, it has a transparent one

Gimp can be used to add transparency to images. If you have GIMP (it's free) you can download the first image and follow these steps to produce the second one.

Use of transparent background images on web pages is often used in association with the z-index property which controls the "depth" of items on a page - the lower the z-index the further the object is from the viewer. The following images show the effect of changing the z-index property. Note that only elements with a position and a value set are affected by the property.

Text Text Text Text Opaque background image with z-index:1. Text with z-index:0
Text Text Text Text Opaque background image with z-index:0. Text with z-index:1
Text Text Text Text Transparent background image with z-index:1. Text with z-index:0

The first image is displayed using this HTML code

   <span style="position: relative; z-index:0;">Text Text Text Text</span> 
   <img src="releaseprintjob.png" style="position: relative; z-index:1;left:-100px" />
© Cambridge University Engineering Dept
Information provided by Tim Love (tpl)
Last updated: May 2010