Post Reply 

Removing the background of an image

Jan 13, 2011, 15:38
Post: #1
Removing the background of an image
Hi, I'm a total n00b who just started using GIMP. I'm sure this is a very simple issue but I can't find a simple, working tutorial for it.

I am writing a game using Ren'Py and have hand drawn my sprites. When scanned into the computer, each sprite is on a white background (the page.)

I need to remove the background of the image, keeping only the picture of the sprite.

none of the tutorials I use are working out, and I've been sitting here for the last two hours trying to solve this problem. I thought that I had, but when I try to use the images in the game, the background of the white page remains. Angry

Please help me out--how do I remove the background of an image?
Find all posts by this user
Quote this message in a reply
Jan 13, 2011, 16:20
Post: #2
RE: Removing the background of an image
1) add an alpha channel to your layer
2) use colors/color to alpha and use the background color

This makes all the pixels with the background color transparent, and those with a close color partially transparent.

You may want to use a selection to protect white parts inside the sprites. Then:
- select the background with the magic wand,
- grow the selection by a couple of pixels to ensure that the border of the sprite is in the selection (the most important work of color-to-alpha is on the border pixels, so they shouldn't be protected)

Color-to-alpha often works well but there are pathological cases. If it's not enough, post a sample picture.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 15, 2011, 07:25
Post: #3
RE: Removing the background of an image
Thank you--seems to have worked! Going to try my sprite in the game now. Smile
Find all posts by this user
Quote this message in a reply
Jan 22, 2011, 15:41
Post: #4
RE: Removing the background of an image
What do you do if the BG has a gradient and you want it transparent?
Find all posts by this user
Quote this message in a reply
Jan 22, 2011, 16:07
Post: #5
RE: Removing the background of an image
I assume this is related to your "Gradient leaves outline" thread? let's continue over there...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jan 22, 2011, 17:10
Post: #6
RE: Removing the background of an image
(Jan 22, 2011 16:07)ofnuts Wrote:  I assume this is related to your "Gradient leaves outline" thread? let's continue over there...

Actually, it is unrelated. I received a logo on a gradient BG that I wanted to change to a transparent one so I could drop it onto any BG color. A friend did this for me (on Photoshop I think), but it left a lot of aliasing artifacts that are too difficult to remove by hand. I discovered a tutorial for doing this clean-up if the background is already transparent, and am happy with it. The problem is changing that gradient BG to transparent without doing a LOT of separate little operations on all the areas.
Find all posts by this user
Quote this message in a reply
Jan 23, 2011, 00:37
Post: #7
RE: Removing the background of an image
There are plenty of tools for foreground extraction:

- magic wand: click and shift-click repeatedly on the background until you have everything selected., and then delete. Or it may be better to use the magic wand on the foreground and then invert the selection
- intelligent scissors
- foreground extraction likely an overkill in your case
- with some logo and background combination, the logo may be isolated in one specific color channel, it appear very cleanly in the color channels in which case, select the channel on which is has got the most contrast, and use channel to selection.
- in the same case one can also use color/decompose (in HSV mode) and then work the Hue image produced with the curves tools to transform it in to a B&W image around the Hue of the color to be extracted, and then copy/paste that into a layer mask.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Print Size vs Image Size ambermc85 1 29 Jun 27, 2017 05:18
Last Post: ythgilb
  Change transparent background color Firion 1 90 Jun 14, 2017 05:24
Last Post: ythgilb
  Coping to different document without image size change Artist 1 76 Jun 11, 2017 11:38
Last Post: ythgilb
  detailed pencil drawing to white background misterroy 3 153 Oct 10, 2014 09:11
Last Post: rich2005
  image cropping to a pre-selected size geomcd49 2 160 Oct 1, 2014 07:09
Last Post: ofnuts

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS