5.3.  Saving images with transparency

There are two approaches of grafic file formats, which support transparent areas on your image: simple binary transparency and alpha transparency. The first mentioned, binary transparency is supported by the GIF format. It can mark one color of the indexed color palette as the transparent color. Alpha transparency is supported by the PNG format, which holds his transparency information in a separate channel: the Alpha channel.

[Note] Note

There is mostly no need anymore, to save images in the GIF format, because PNG supports all the features of GIF and offers additional features (eg. alpha transparency). Nevertheless, this format is stil used for animations.

Procedure 6.5.  Creating an image with transparent areas (alpha transparency)

  1. First of all, we're using the same image as in the tutorials before: Wilber the GIMP mascot.

    Figure 6.5.  The Wilber image opened in the RGBA mode.

    The Wilber image opened in the RGBA mode.
  2. A requirement for saving an image with alpha transparency is an alpha channel. To check if the image has an alpha channel, go to the channel dialog and verify, that besides Red, Green and Blue an entry with “Alpha” exist. If this is not the case, add a new alpha channel from the layers menu.

  3. You're now able to remove the background layer to get a transparent background, or create a gradient from color to transparency. What you want to do depends on your fantasy. To demonstrate the abilities of alpha transparency, we'll make a soft glow in the background around our wilber.

  4. After you're done with your image, you can save your image in a PNG Format.

Figure 6.6.  Mid-Tone Checks in the background layer represent the transparent region of the saved image during editing in Gimp.

Mid-Tone Checks in the background layer represent the transparent region of the saved image during editing in Gimp.