As has already been discussed briefly in this series, layers can contain transparency to a varying degree, or they can be totally opaque. This is an important concept because transparent layers allow designs to be more intricate and contain more depth, and also allow compositions to be saved without backgrounds.
To better understand this concept of transparency, I have three layers open in my composition (highlighted in green in the photo above). The first layer is Layer 1 – which is at the top of my layer stack and is a totally transparent layer. The second layer is an image – titled “Model in Red Chair,” which is totally opaque and does not contain transparency (more on that in a second). The third layer is our Background layer, which is also totally opaque but is filled with the color white. This layer also does not contain transparency.
Adjusting Layer Transparency with the Opacity Slider
There are a couple of ways to tinker with the transparency of a layer, with the results depending on how you are interacting with a layer’s transparency. For example, if I click on the Model in Red Chair layer (denoted by the green arrow), I can use the opacity slider at the top of the Layers panel (red arrow) to adjust the overall opacity of this layer. By default, the slider is set to 100 – which means it has 100% opacity or is totally opaque. If I drag the slider to the left, the number becomes less than 100, which means the image layer now contains a percentage of transparency.
If I drag the slider until it reaches a value of 50 (as demonstrated in the photo), that means the image layer now is 50% opaque and 50% transparent. This is why we can somewhat see through this layer, revealing the white background behind it (which consequently makes our image look a bit lighter, since adding white to all your pixels will lighten those pixels up).
I can also manually type in a value in my opacity slider if I want a precise number here. To do this, I just need to use my mouse to highlight the current value (it is set to 50.0 right now), then type my new number and hit the enter key. For example, I’ll type 23 to set my opacity value to 23% and my transparency value to 77% (as shown in the area highlighted in green in the photo above).
On this note, I’d like to point out that there is an inverse relationship between opacity and transparency – or in other words the value of one of these measurements is always the value of the other measurement subtracted from 100. So, if my opacity for my layer is set to 65%, my layer is 35% transparent. If my layer is 40% transparent, then the opacity must have been set to 60%. Yay math.
I can also use the arrows on the right side of the opacity slider (denoted by the red arrow) to increase or decrease the opacity by 1 percentage point. So, if I click the down arrow once, my layer’s opacity will now be 22%. If I click the up arrow twice, my layer opacity will be 24%.
Note: when my layer opacity is set to 0%, it will no longer be visible because it will be totally transparent. My layer opacity can never be less than 0% or more than 100% – it will always fall within this range.
For the next part of this tutorial, I am going to set the opacity of my layer back to 100% (you can either drag the opacity slider all the way to the right or manually type in the value “100”).
Alpha Channels and Layer Transparency
The next important concept when it comes to transparency is something called an Alpha channel.
Compositions in GIMP always contain some sort of channels to determine how colors will be displayed in the composition. These channels make up what’s called the Color Space. The most commonly used color space, and the default color space in GIMP, is the RGB color space. This means that your image is comprised of three color channels – Red, Green, and Blue (which is why we use the acronym “RGB”). You can see these color channels by going to the “Channels” tab next to your “Layers” tab in the “Layers, Channels, Paths, Undo History” area (denoted by the red arrow in the image above).
Here, you can see we have a Red, Green, and Blue channel, with each one stacked on top of the other in the same way we stack layers. However, you’ll notice there is also a fourth channel visible here – the Alpha channel. This channel represents true transparency for a layer. If a layer does not have an Alpha channel, it will not be capable of producing isolated areas of transparency.
In other words, we can decrease the overall opacity of the entire layer at the same time (like we did with the Opacity slider earlier in this article), but we cannot take a tool like the Eraser tool and create a small area of transparency on the layer.
This being said, since we can see there is an Alpha channel associated with the active layer we are on (our image layer), we must be able to produce an isolated area of transparency, right? Well – it’s a little more complicated than that.
If I go back to the layers panel (red arrow in the photo above), you’ll notice I’m still clicked on my Model in Red Chair image layer (green arrow).
Now, if I grab my eraser tool from the toolbox (red arrow in the photo above), and erase a random area on my layer, you’ll notice it doesn’t actually produce transparency where I erase. It instead paints the color black (blue arrow in the photo). Why?
Well, in GIMP you have to specify for each layer that does not already contain transparency that you would like to add an alpha channel to that layer and thus give it transparency. Right now, only Layer 1 contains transparency because we created a new layer and filled the background with transparency (visit my previous article in this series where I created this layer). This is why the Alpha channel was displayed in our Channels dialogue (even though we were clicked on our Model in Red Chair Layer – in other words it was kind of misleading because it seemed like our Model in Red Chair layer had an alpha channel even though it did not).
The other two layers in the composition, the Model in Red Chair image layer and Background layer, were created without transparency (JPEGs do not contain transparency, and we filled our Background layer with white rather than transparency when we first created it).
So even though it shows an Alpha channel exists for our composition, it only actually exists for Layer 1. We have to create alpha channels manually for the other two layers. Otherwise, when we try to erase an area (either with the eraser tool or with another tool like a selection tool), the area will be filled in with our current background color, which is black.
To do this, all I need to do is right click on my active layer (denoted by the red arrow), then click on Add Alpha Channel (blue arrow – if you hover your mouse over this option, a message will display saying this option will “Add transparency information to the layer”).
After you have added an alpha channel to the layer, two noticeable things will happen right off the bat. For one, the name of your layer will no longer be in bold when it is your active layer (this is a very subtle change, but if you undo Adding an Alpha Channel and look at your layer name, you will notice it is in bold font when clicked or active. Re-doing your Add Alpha Channel action, the font will no longer be bold when the layer is active).
The second thing you’ll notice is that when you right click on the layer, the Add Alpha channel option will now be grayed out – or inactive – in the menu. You can no longer select this option because your layer now has an alpha channel.
Now that we have an alpha channel, I will once again use my eraser (red arrow) on my layer. This time, instead of painting black, it will reveal the white background layer (blue arrow) that is underneath our Model in Red Chair layer.
If I hide the Background layer by clicking the show/hide icon (red arrow), you will now see a gray checkerboard in the area where we used our eraser (blue arrow). This area represents a transparent background. That means there are no pixels painted in this area – it is totally see-through.
When it comes to making portions of your image transparent (i.e. for popular tasks like erasing an image background), erasing directly on the layer, as we have done here, is called “destructive” editing because we have now essentially lost all of the pixels we just erased on our image (we can of course undo the action right now since it was the last thing we did, but there are cases where you may perform another action before realizing you didn’t want to erase).
Luckily, though, there is a more “non-destructive” method for erasing parts of your image and creating transparency. I will cover this topic in my next article on Layer Masks.
That’s it for this tutorial! If you liked it, you can check out my other GIMP Help Articles, watch any of my GIMP Video Tutorials, or enroll in any of my Premium GIMP Classes & Courses.