Is your GIMP eraser not working? This can be a simple fix depending on the problem you are experiencing.
What the Eraser Tool Does
For starters, the eraser tool allows you to erase pixels in your image or composition to a background color or to transparency. Whether it erases to a background color or transparency depends on what layer you have selected, and whether or not that layer has an alpha channel.
Adding an Alpha Channel to a Layer
Layers in GIMP have 3 color channels and an alpha channel. The color channels are Red, Green, and Blue, and these colors are combined together to create what’s called the Composite Image – or the full-color image you see on the screen. However, some images or compositions also have a fourth channel, called the Alpha channel, which represents a layer of transparency below the composite image. In other words, if you were to remove the color pixels from your image, a transparent or see-through background would show up where those pixels were removed.
On the other hand, if you do not have an alpha channel on a layer, GIMP simply uses the eraser tool to paint the background color you currently have selected where you are attempting to “erase” pixels (as demonstrated in the photo above – I pointed out the eraser tool in the toolbox with a red arrow. The green area painted on the photo is where I tried to use the eraser without an alpha channel).
So, to add an alpha channel to a layer, right click on the layer inside of the layers panel and go to “Add Alpha Channel” (denoted by the red arrow in the image above).
You can double check that your image now has an alpha channel by going over to the “Channels” tab (red arrow) and looking for the channel titled “Alpha” underneath the three color channels (green arrow).
If I head back to my Layers panel and now draw with the eraser on my image, the pixels that I erased will now show up as a grey checkerboard rather than my background color. The grey checkerboard represents transparency in GIMP. So, if I exported this as a file that supports transparency (such as a .PNG file), the area where the grey checkerboard currently is would be totally see-through in the final file.
Erasing When You Have Multiple Layers
Everything we’ve demonstrated to this point included a composition that only had a single layer – the image layer – but what if your composition has multiple layers?
In GIMP, you can have an image layer, a color layer, and a text layer. So, for this example, I’ll create a new layer by clicking the “Create a new layer icon” (denoted by the red arrow) and will name it “Green Layer.” I’ll set the dimensions (width and height) to 500 pixels by 500 pixels and will set “Fill with” to “Background color” to fill the layer with our currently selected background color (the bright green we’ve been using).
I will also create a text layer by grabbing my text tool (denoted by the red arrow in the photo above), then clicking on my composition and typing “This is a text layer.”
If you look over at the layers panel, you’ll see that we now have 3 layers – an image layer, a color layer (which is really just a blank layer that has a background color), and a text layer.
So, what happens if I want to erase some of the green from our Green Layer? If I click on my eraser tool from the toolbox and attempt to erase the green, you’ll see that only my text gets erased. I’ll hit ctrl+z to undo this erasing.
The key to having your eraser tool work in GIMP (the way you intend it to) is to ensure that you are clicked on whatever layer the pixels are on that you are trying to erase. Since I was clicked on the Text layer (denoted by the green arrow in the photo above) just now when trying to erase, the pixels from that text layer got erased.
So, for example, since we want to erase the green pixels, we need to ensure we are clicked on the Green Layer in the layers panel (denoted by the green arrow in the photo above). Once I am clicked on that layer (making it my active layer), I can now erase only the green pixels (and not the text or image pixels).
Erasing Pixels from Multiple Layers at the Same Time
The above example covers how to erase pixels on individual layers – but what if you want to erase pixels from all three layers at the same time?
There are two methods for doing this – one if less complicated but is a “more destructive” way of editing. The other method is a bit more advanced, but is a “less-destructive” way of editing.
Method 1 – Merge Down
For the first method, I can right click on my top layer (the text layer) and click “merge down.” This will merge my text layer and Green Layer onto a single layer. I can then click on this merged layer and again choose “merge down.” This will merge all three of my layers together onto a single layer.
I can now click on my eraser from my toolbox and erase pixels from all three layers at the same time. The only problem is that I can no longer move the objects on each individual layer since they have all been merged together on a single layer.
Method 2 – Layer Group Mask
The second method, as I alluded to a little earlier, is a bit more advanced. This is because it uses a layer group combined with a layer mask instead of the eraser tool. (Note, this method will only work for GIMP versions 2.10 or newer. It will not work for GIMP 2.8).
For starters, I’ll click the “New layer group” icon to create a new layer group folder in my layers panel (denoted by the red arrow in the photo above).
Next, I’ll click and drag each layer into the layer group (start with the bottom-most layer first, and work your way up to the top layer – as I did in the photo above, denoted by the green arrow. This will ensure that the layers inside the layer group stay in order).
Now, I can right-click on the layer group and go to “Add Layer Mask.”
Under “Initialize Layer to:” I’ll choose “White: Full Opacity.” I’ll click “Add” to add the layer mask.
Now our layer group has a mask. The mask is white, which means we can still see all of the original pixels from our three layers. However, if I paint black on the layer mask, it will essentially act as an eraser. So, I’ll grab a paintbrush (blue arrow), change the foreground color to black, and make sure I am clicked on the layer mask (red arrow).
The areas where I have painted black have now shown up as transparency on my image, effectively erasing all of the pixels from all three layers at the same time. The reason this is considered “less destructive” than the first method is that I can go back at any time and paint white on my layer mask to bring those pixels back, or can simply delete the layer mask altogether.
Unlocking Layer Pixels and Alpha Channel
If none of the above methods have solved your eraser not working, don’t worry – there is still one more topic to cover here. The eraser tool may not work if you have the pixels or transparency on a particular layer locked.
Going back to our three individual layers (before I added them to a layer group), I can click on my Green Layer and then choose the “Lock pixels” option in the “Lock” section of the layers panel (denoted by the red arrow).
Now, if I try to erase the pixels on this layer, I get an error message in my Title and Status bar (at the bottom of the GIMP image window) stating “The active layer’s pixels are locked.” In other words, we cannot make any changes to the pixels on the layer while the pixels are locked – and that includes trying to erase the pixels.
I’ll unlock the pixels on this layer by clicking the “lock pixels” icon once again while the Green Layer is still my active layer.
I can also lock the alpha channel on the green layer by clicking the “Lock alpha channel” icon (denoted by the red arrow). This will perform a similar function to the “Lock pixels” icon, except it will only lock my alpha channel – or the transparency in my image. I can still paint on this layer with something like the paint tool, but I can not use my eraser on this layer. If I try to use my eraser while the alpha channel is locked, I get a message in my Title and Status bar stating that “The active layer’s alpha channel is locked” (denoted by the blue arrow).
To unlock the alpha channel, I can simply make sure I am clicked on the Green Layer and then click the “Lock alpha channel” icon once more. The alpha channel should now be unlocked, allowing me to erase pixels on this layer once again.
If you are still experiencing issues with your eraser, your GIMP install may have a bug – which I recommend reporting to the GIMP team.