2.3. Enregistrer des images avec transparence

There are two different approaches used by graphic file formats for supporting transparent image areas: simple binary transparency and alpha transparency. Simple binary transparency is supported in the GIF format; one color from the indexed color palette is marked as the transparent color. Alpha transparency is supported in the PNG format; the transparency information is stored in a separate channel, the Alpha channel.

[Note] Note

The GIF format is rarely used because PNG supports all the features of GIF with additional features (e.g., alpha transparency). Nevertheless, GIF is still used for animations.

Procédure 6.1. Création d'une image avec zones transparentes (transparence Alpha)

  1. Tout d'abord, nous allons utiliser la même image que dans les didacticiels précédents : Wilber, la mascotte de GIMP.

    Figure 6.8. L'image de Wilber en mode RVBA.

    L'image de Wilber en mode RVBA.

  2. To save an image with alpha transparency, you must have an alpha channel. To check if the image has an alpha channel, go to the channel dialog and verify that an entry for « Alpha » exists, besides Red, Green and Blue. If this is not the case, add a new alpha channel from the layers menu; Layer+TransparencyAdd Alpha Channel.

  3. The original XCF file contains background layers that you can remove. GIMP supports standard filters that support creating gradients; look under Filters+Light and Shadow. You are only limited by your imagination. To demonstrate the capabilities of alpha transparency, a soft glow in the background around Wilber is shown.

  4. Quand vous en avez fini, Enregistrez votre image dans le format PNG.

Figure 6.9. L'image de Wilber avec transparence

L'image de Wilber avec transparence

Les tons moyens du calque d'arrière-plan représentent la région transparente de l'image enregistrée lors de son traitement dans GIMP.