Cutting out a photo and removing white edges in GIMP

When you view this image on a white background it looks fine, but when you view it on a black background (or other dark colour) then there are little white bits around the image. It may be tempting to try and remove these with an eraser effect – but that will take a very long time and won’t look as good. Here is a simple way of removing them using a mask.*

This guide uses GIMP – the Gnu Image Manipulation Program. The GIMP is a Free Software photo and image (raster) editor and you can download it, gratis, here..

Right click on the layer in your layers dialogue and click “Layer to Image Size”

Once you have opened your image, make sure that your image is on a layer which fills the whole screen by right clicking on the layer in your Layers dialogue and clicking Layer to Image Size.

Next You need to duplicate the layer. To do this you right click on the layer again in your Layers dialogue and this time choose Duplicate.

Right click on your layer and select “Duplicate”.

Next turn the duplicate layer into a black and white version. To do this click on the layer, and in the GIMP menus go to Colours > Threshold. When the Threshold dialogue appears drag the arrow all the way to the left. You are aiming to have an image where the background it totally black (or transparent) and the area with your image in is totally white.

Other dialogues, such as the Brightness-Contrast option, also under Colours, may be helpful in this stage of the process.

Use the Select by Colour button to select the BLACK / TRANSPARENT area (not the white)

Select the black / transparent area of your new layer using the Select by Colour tool. Go to the Select menu and click Grow. Choose a small number of pixels, depending on how much white you have. I have chosen 4 pixels. Click OK.

If you zoom in (use the plus / add key) you will see that the selection is now a few pixels closer to the centre of your logo than it was before.

Press your Delete key (depending on your current layers and transparency set up you may or may not see a noticeable change). Go to Select > None.

Right click on your layer in your Layers dialogue again and this time select AddLayer Mask. In the Add Layer Mask dialogue click Greyscale copy of layer. You will see your layer mask appear next to the layer in your Layers Dialogue.

Go to Edit > Select All (or try using Control+A) and the go to Edit > Cut (or use Control+X). Click on your logo layer then right click and Add Layer Mask. This time choose White (full opacity).

You will see a new Layer Mask next to your logo.

Go toEdit > Paste (or Press Control + V). You will see the layer mask you made with your Duplicated layer appear in the layer mask for your original logo layer.

If you now look at your logo with a black background behind it (try Layer > New Layer if you need a dark layer) you will see that the white bits have been cut away (they are actually only hidden at this stage, if you right click on your logo Layer and click Disable Layer Mask you can see your logo is untouched).

If there are any white parts left, right click on your logo layer (not the duplicate) in your Layers dialogue and click Mask to Selection. Go to Select > Grow and chose a small number of pixels again. Press OK. Press your delete key. Notice that more of your logo has been hidden. Repeat this until all of the white parts are hidden. Save your file at this point especially (File > Save or Control+S)

Last of all, you need to apply your layer. It’s probably worth saving the document as something else first to allow you to make changes to your mask in the future if you need to. I saved mine as Logo_Perfect.xcf (xcf is the gimp format. I will export it as a .png or a .jpg later). When you have saved your file right click on your logo layer in your Layers dialogue and choose Apply Layer Mask. You will see the mask has gone and the white parts have now been properly cut away, and not just hidden.

You have done it! Well done!

*You could use this guide to cut out the whole image from scratch. This guide is is useful too (but out of date). Also, there may be other ways to do the task I have described, this is just the way I figured it out first