anna.morris's blog

Just another FSFE Fellowship Blogs site

Cutting out a photo and removing white edges in GIMP

This Blog is taken from my Ethical Pets Wholesale blog for small businesses.

Here is the problem:

Screenshot from 2013-06-05 18:52:54

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..

Screenshot from 2013-06-05 19:05:10 Right click on the layer in your layers dialogue and click “Layer to Image Size”

number 1 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.

Screenshot from 2013-06-05 19:10:39 Right click on your layer and select “Duplicate”.

 

2

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.

Screenshot from 2013-06-05 19:14:11

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

3

Screenshot from 2013-06-05 19:25:25 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.

Screenshot from 2013-06-05 19:25:34

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.Screenshot from 2013-06-05 19:26:41

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.

4Screenshot from 2013-06-05 19:39:52Right click on your layer in your Layers dialogue again and this time select Add Layer 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.

Screenshot from 2013-06-05 19:46:56

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).

Screenshot from 2013-06-05 19:47:16_2

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

5Go toScreenshot from 2013-06-05 20:03:55 Edit > 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).

Screenshot from 2013-06-05 20:05:19

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)

6

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.

Screenshot from 2013-06-05 20:24:17

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 🙂