movie rental service
movie downloads.

Removing Backgrounds Quickly in the Gimp

August 24, 2007 – 5:27 pm

After publishing an article about removing backgrounds quickly in Photoshop, many have asked me how to do the same thing with the Gimp. While there is no equivalent to the Extract filter in the Gimp, you can still remove backgrounds fairly quickly. At Linux.com there is a good explanation of some techniques. Here, I will show you how to do it with the Create and edit paths tool.

1. I will use the same test image as the Photoshop tutorial.
maria1.png

2. Use the Zoom tool to magnify the image to where you feel comfortable.

3. Use the Create and edit paths tool and connect the dots. The key is to place the dots where there are changes in the shape of the image.
maria_dots.png

4. Click between the dots you made and move the line so that it curves around the edges. You can use the square handles that appear to further refine the curves.
maria_curves.png

5. Make sure you complete the full path by making a line across the bottom. Use Shift-V to make a selection based on your path, then Cntrl-I to select the inverse. Then Layer->Transparency->Add Alpha Channel. Finally, Cntrl-K to remove the background.
maria_transparent.png

6. Create a new layer and drop in your new background and you are done.
maria_final1.png

If you know of a better and faster way to do this, share your knowledge in the comments.

  1. 26 Responses to “Removing Backgrounds Quickly in the Gimp”

  2. Thanks for the GIMP walk through - again people over @ http://www.askTheAdmin.com love these tips!

    Keep up the AMAZING work!

    One!

    By AskTheAdmin on Aug 25, 2007

  3. This is good. I have been looking for just this thing. Somehow I thought it would be easier, but what the heck…this will work and it’s exactly what I needed. thanks.

    By helios on Aug 25, 2007

  4. OK, here’s my attempt at posting my URL:

    http://penguinpetes.com/b2evo/index.php?title=gimp_tutorial_popout_photo&more=1&c=1&tb=1&pb=1.

    Also shows masking a subject from a background in prep for making a popout photo effect.

    By Penguin Pete on Aug 25, 2007

  5. I don’t know of a faster way to do this now, and I don’t know much about the ongoing development with the GIMP, but when GIMP 2.4 is released (the first release candidate has been released - http://www.gimp.org/) there will be an intelligent scissors tool that may make this much easier.

    To see it in action:

    http://www.youtube.com/watch?v=A_FWoD82U_o

    By John on Aug 25, 2007

  6. If the background is sufficiently different from the foreground, I get quick results by selecting the background with the color-selection tool and cutting the selection (ctrl-x). In case I select a shade which is also in the foreground, I restore it using crtl-z

    Using this technique until most of the background is transparent, I can get rid of bigger leftovers (in the corners) using the rectangle-selection, and the smaller details with the eraser.

    That was fast enough until now, but I will try your tip the next time I need something knocked-out.

    By Stefan Waidele on Aug 25, 2007

  7. Man, this is great, I read your last blog about how to do this in Photoshop then left a comment saying that I wish I knew how to do this in GIMP, and BAM here it is. Now for my next wish, I sure wish I could find a huge bag of money, I’ll be waiting, hahaha.

    Bryan
    http://www.racinsite.com

    By bryan on Aug 26, 2007

  8. Great!
    If your object is fading over your background it is not so simple to extract it.
    You can use that red dot at the bottom left of your image screen. Press it. See that all is tainted in red? Well, to select your background, you should ‘paint’ with white using your common tools: if you paint it with an irregular brush you might be creating a blured limit between your image and the background, ok? Then select something and use the fill bucket to fill it with white. That means, only cleaning the red taint and seeing the right image.
    After painting all the red tainted image, togle again the red dot and you’ll find the image selected in a way that you’ll be able to clear the background without making a sharp cutting of the continuity of the degradee.
    I hope that this was what you where asking for.
    alberto

    By chanio on Aug 27, 2007

  9. thanks, but you can use SIOX: http://www.siox.org/

    By Omid on Aug 27, 2007

  10. 1. The GIMP already has intelligent scissors, and imho works better than Photoshop’s.

    2. Photoshop or the GIMP, the way I’ve found to be both the fastest and most reliable is to draw paths, then convert the paths to a selection. It’s only slow and hard if you’ve never drawn paths. Spend a little time with it and you’ll never go back to any dodgy methods using painting.

    By regeya on Aug 27, 2007

  11. Shouldn’t you be doing all this on a layer mask, not the original image?

    Destructive editing is bad, mmkay?

    By David on Aug 27, 2007

  12. If you’ve got a good bit of contrast between the foreground and background, you can use a layer mask + the threshold tool to quickly erase the background. This works really well for pulling out a model who was photographed against a solid-colored photo paper backdrop.

    Create a layer mask (Layer > Mask > Grayscale copy of layer, inverted)
    Layer > Mask > show layer mask
    Tools > color tools > threshold.

    Play with the threshold until the subject is all (or mostly) white and the background is black.

    Use the eraser and/or paintbrush to clean up any spots that need it (black spots on the foreground or white spots on the background.

    Now use the “select regions by color tool” and select the background (black) area. Shrink your selection by 1 px and then feather the selection by 2 px. Use the bucket fill tool to fill the background with black to cover the little border you just created.

    Now apply the mask (layer > mask > apply mask) and see your results.

    If nothing else, this can get you 80-90% of the way complete, then use the path tool to pull out the spots that you couldn’t get with the threshold mask.

    By Joe on Aug 27, 2007

  13. Who cares.

    Just tell me who is the girl?

    By nic on Aug 28, 2007

  14. Sorry but result looks quite worthless.

    If you change the background then you have to take care of proper lighting and reflexes. Otherwise picture will look unnaturally. Especially if you change the electric light to the sunlight like in this case.

    Also edges must be not sharp. Just look at her hair. On the original photo they look like hair but on the second photo they look like a plastic bucket.

    By gregory on Jan 22, 2008

  15. My vote will be for Photoshop method.. I agree with Gregory! There is a lot of difference between photoshop way and the gimp way. Amazingly in photoshop the hair areas super perfect. It helped me a lot, to change the background for 5 photos in just 4 minutes. - Thank you!

    By Mohammed Arafat on Apr 22, 2008

  16. In gimp, I get to step 5 not exactly sure what “place a line across bottm” means, and when you get to Cntrl-k, it does not remove the background?

    Any suggestions.

    By George on Jun 23, 2008

  17. I had the very same problem as George. Can someone help? the last Ctrl-k step doesn’t do anything, and the “create & edit paths” tool remains active. I also did not understand “place a line across the bottom”

    By Delia on Oct 22, 2008

  18. Thanks for posting this it is great to have a step by step walk through. I love being able to change background and play around with what I can do to photos.

    By Tips Photo on Feb 3, 2009

  19. Didnt work. adobe photoshop is way better at this kind of thing

    By rush on Feb 21, 2009

  20. I think that the SIOX plugin is one of the best for image extraction in GIMP.

    By Rahul on Feb 25, 2009

  21. “PLACE A LINE ACROSS THE BOTTOM” meaning dont forget as your outlining the image to continue outlining it towards the bottom of the picture…if im still not making sense….make sure you make a complete circle around whatever it is that you are trying to manipulate…if you dont make a complete circle with the dots around whatever it is you are working on then it wont extract it.
    To the second part of that comment regarding it not working: I had the same problem where it wasnt doing anything and i thought it didnt work but then i went back and it worked..just took my computer a little bit to catch up.

    By ashley on Apr 14, 2009

  22. I’m not entirely sure if people still read this, but whatever.

    First thing you’ll want to do is ‘create a new image’ (file > new) you can make it the same size as the photo you’re editing. But in the advanced options bit, mark the “Fill With” section as transparency. Then click OK.

    Now, go to file > ‘open as layers’ and open the picture you want to edit. (it will lay it on top)

    Now, select the “Free Select” tool and go around the image, this might be a little fiddly, but no different then using the Paths tool. It will automatically select the selection. (also: it doesn’t have to be perfect.)

    Once you’ve done that - Press CTRL-i, then click the “layer” tab (As above) and go down to transparency and click “Add Alpha Channel”.

    You now have a transparent background. Well… Kinda.

    This is where the “it doesn’t have to perfect” thing comes into play. If you’ve just made a rough outline grab the eraser tool and start erasing! It wont erase the picture you’ve selected. (it only erasers outside of the selection - Inside stays perfectly intact.)

    Once you’ve done that you can go to the “select” tab and click “None” which will remove the freehand selection. You can now do the fine detail work - Using the eraser or you can use the paintbrush in “color erase” mode, which gives you different types of brushes. (Creates different effect)

    Ta-Da. I use this method to create t-shirt templates.
    (Oh, remember the image you edit HAS to be in PNG form, not JPG.)

    Also, you could probably just add your photo on top of the transparency layer and press CTRL-i and then ‘add alpha channel’, then use the eraser to get rid of the background. Which might be faster.

    Anyways, Hope I helped.

    By Rob on Apr 14, 2009

  23. You can use the scissors select tool instead. I find it’s easier that way… you don’t have to go through all the adjustments.

    By Sam on May 3, 2009

  24. I had the same problem as the last two comments. Noone seems to have replied to them and that was a long time ago….any suggestions??

    By Fabia on May 27, 2009

  25. Everything goes good till i add “Add Alpha Channel” after that when i press ctrl+k nothing happens :(

    By Gowtham on Jul 1, 2009

  26. 1. Click on alpha channel whatever it is, even though it does nothing.

    2. Click on inverse, whatever it does, even though it does nothing.

    3. Hit control-K, it does nothing.

    4. Try to copy the selection instead, Select move tool, move the pic all the way to the right to see checkerboard thing.

    5. Attempt to paste selection. Does not work.

    6. See checkerboard with highlighted line, but not the object you selected.

    7. Close GIMP.

    8. Punch monitor.

    9. Delete GIMP.

    By Doesn't work. on Jul 5, 2009

  27. after inverting selection, right click, edit, clear.

    By travis on Aug 7, 2009

Post a Comment