Sometimes deleting a background to transparency isn’t as simple as it seems. A good example of this would be glass. I’ve gone over various ways to delete backgrounds to transparent with GIMP in the past, but what about for more complicated imagery, like glass? In this instance, it’s not simply a matter of creating a selection around your subject and deleting everything outside of it. With glass, part of the background shows through, so we have to delete it in such a way that the background is removed from the glass, but without removing the glass itself. In this tutorial I’ll be demonstrating how to do just that.
Deleting the background from glass with GIMP requires that we work with blend modes and layer masks. And when we place the transparent glass over a new background, we’ll have to distort that background within the glass in order to give it a realistic look. For this we will be using displacement mapping.
It’s not nearly as complicated as it seems, so don’t let it intimidate you.
Delete The Background From Glass with GIMP
For this demonstration we will be deleting the background from the following stock image, which depicts a mason jar on a white background:
Before getting started, it should be noted that this technique will only work on images where that glass is on a white background, so make sure to choose your glass images accordingly.
The following video tutorial will walk you through the process of deleting a background from glass with GIMP:
The following is just a brief written overview of the steps taken. It is recommended that you refer to the video tutorial above for complete step-by-step instructions.
Step 1: Remove The Surrounding Area
To get us started, we’ll be using the Pen Tool to create a selection around the glass jar, then inverting the selection and deleting it to transparent:
Although the surrounding background has been deleted, the white area is still showing through on the glass. That’s okay though because we are going to address that in the following steps.
Step 2: Paste The Image Onto The New Background
Now we are going to copy the glass jar and paste it onto a new background, which is opened in another tab. For this lesson we will be using the following background image:
Paste the jar as a new layer, then set the blend mode to Multiply:
As you can see, the glass is now transparent, but we’ve lost some crucial details. Let’s work on restoring them.
Step 3: Apply A Layer Mask To The Glass
Duplicate the glass layer and set the blend mode back to normal.
Now, copy the duplicated layer, apply a layer mask, and paste it into the layer mask:
Now we’re going to adjust the Curves of the layer mask so that the white areas are removed. To do this, open the Curves menu and slide the node in the bottom-left corner towards the bottom-right:
As you adjust the curve, the glass will become transparent:
Click OK to apply the changes.
Step 4: Distort The New Background Within The Glass
To really bring this effect home, we’re now going to distort the background within the mason jar so that it looks more realistic.
Create a duplicate of the background layer, then apply a Displacement Map using the original glass jar layer for both Aux 1 and Aux 2. This will warp the background according to the contours of the glass jar:
It should be noted that this step is rather complicated, so if you’re struggling to understand how this works, be sure to refer to the video tutorial above for complete instructions.
Step 5: Adjust The Focus Of The Image
Now that we’ve deleted the background from glass with GIMP and placed it on a new background, it’s time to blur the background so that it appears as if the glass is in focus and the background is out of focus. This will help it look more realistic.
To do this, simply apply a Gaussian Blur to the original background image (not the distorted copy!) Then, we’ll apply a layer mask with a gradient of black to white to make sure the table remains in focus, but the grass and sky transition to being out of focus:
And with that we are finished! That is how you can remove the background from glass using GIMP.
Deleting the background from glass is a tricky and advanced process, but with a little smoke and mirrors we can make it happen with relative ease. The technique used is not too different than the used to crop hair with GIMP. Layer masking plays a pivotal role for each.
If you have any question, or if any part of this lesson was unclear, simply leave a comment below!
Become A Master of Adobe Illustrator!
Want to learn more about how Adobe Illustrator works? Check out my Illustrator Explainer Series - a comprehensive collection of over 100 videos where I go over every tool, feature and function and explain what it is, how it works, and why it's useful.
This post may contain affiliate links. Read affiliate disclosure here.