Post Reply 

A specific color to transparent

Dec 26, 2011, 06:10
Post: #1
A specific color to transparent
I have a jpeg image of a motorcycle on a pure yellow background. I want to make the yellow transparent. Naturally there are a lot of spaces within the motorcycle image that contain yellow.

I followed instructions I found...

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 results in the checkerboard being applied to the motorcycle, not the yellow background. I assume that's okay.

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

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)


This selects only the area outside the bicycle, but I don't mind reselecting smaller areas, if I can.

- grow the selection by a couple of pixels to ensure that the border is in the selection (the most important work of color-to-alpha is on the border pixels, so they shouldn't be protected)

Then what?
Find all posts by this user
Quote this message in a reply
Dec 26, 2011, 10:36
Post: #2
RE: A specific color to transparent
You've got it essentially right:

- Use magic wand
- select background by clicking on it (this selects only contiguous areas, so "islands" of background won't be selected, for instance betwen spokes, or throttle/clutch/brake cables and pipes)
- add left-over islands by shift-clicking on them. Make sure you've got everything (inspeat at 200% zoom). Selecting a bit too much is a lesser worry than missing something.
- "Select/Save to channel": this will save you selection so it can be reused later if we need to refine the method for your picture. Save you file as a .XCF to save that selection with he rest.
- "Select/Grow": grow selection by 2 pixels
- "Colors/color to alpha", and use the color picker in the dialog to pick your background color
- Apply: done

If results aren't up to expectations, post the original picture here (or a URL) to see if another technique is more appropriate or if this technique should be refined.

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 1, 2012, 04:33
Post: #3
RE: A specific color to transparent
Sorry to be so late getting back on this, but I was a combatant in the Computer Wars, with a wireless router skirmish thrown in. Missing an arm and a leg now, but otherwise okay.

When I followed the above instructions, I got as far as Colors/color to alpha, only to find that color to alpha was grayed out, leaving me with nowhere to go.
Find all posts by this user
Quote this message in a reply
Jan 1, 2012, 11:32
Post: #4
RE: A specific color to transparent
Is that a GIF? If you go to "Image/Mode" is "Indexed" checked? If so:

Quick method, but may not give good results:
- Select by color (no threshold, and pick the background)
- [Delete]

Longer method, may give better results:
- Convert the image back to RGB: Image/Mode/RGB
- Then use the methods explained earlier

But editing GIF images usually leads to intense frustration because they are limited to 256 colors total.

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 1, 2012, 18:38
Post: #5
RE: A specific color to transparent
No, it was a jpg image, then converted to XCF as you instructed. If I open the jpg image, then color to alpha isn't grayed out.
Find all posts by this user
Quote this message in a reply
Jan 1, 2012, 18:40
Post: #6
RE: A specific color to transparent
How about "Image/Mode"? RGB?

Otherwise, open the Layers list (Ctrl-L) and make sure that one layer is selected.

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 1, 2012, 20:53
Post: #7
RE: A specific color to transparent
And "Indexed" isn't selected on the XCF file. RGB is.
Find all posts by this user
Quote this message in a reply
Jan 1, 2012, 21:10
Post: #8
RE: A specific color to transparent
(Jan 1, 2012 20:53)quailrancher Wrote:  And "Indexed" isn't selected on the XCF file. RGB is.
Then there are only two ways this can happen as far as I can tell:
  • You are actually editing a channel and not a layer (something is selected in the Channels list, and nothing in the Layers list)
  • You are editing a layer mask instead of the layer proper.

Otherwise post the XCF here or elsewhere.

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 2, 2012, 00:36 (This post was last modified: Jan 2, 2012 01:14 by quailrancher.)
Post: #9
RE: A specific color to transparent
There was a selection mask showing in the channels dialogue. I deleted that and the color to alpha returned. I clicked on that, the proper color was selected, and the bar moved across the screen. The image was unchanged, so apparently there was something I didn't do.
Find all posts by this user
Quote this message in a reply
Jan 2, 2012, 01:18
Post: #10
RE: A specific color to transparent
(Jan 2, 2012 00:36)quailrancher Wrote:  There was a selection mask showing in the channels dialogue. I deleted that and the color to alpha returned. I clicked on that, the proper color was selected, and the bar moved across the screen. The image was unchanged, so apparently there was something I didn't do.
No need to delete the selection... just make sure a layer is selected, that will deselect the channel.

Make sure the layer has an alpha channel (Layer/Transparency/Add alpha channel).

Otherwise, If you duplicated the layer, then you are seeing the duplicate version through the transparent parts, so you can't see the changes.

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 2, 2012, 01:53
Post: #11
RE: A specific color to transparent
I see my image, labeled "background" under layers. Only one. " Add alpha channel" is grayed out.
Find all posts by this user
Quote this message in a reply
Jan 2, 2012, 02:02
Post: #12
RE: A specific color to transparent
Getting short on ideas if I cannot see the XCF...

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 2, 2012, 02:55
Post: #13
RE: A specific color to transparent
Alas, Photobucket won't pick up the Gimp image. Maybe I'll go back to my old version of Photoshop and see what I can stumble across. Many thanks for the effort.
Find all posts by this user
Quote this message in a reply
Jan 2, 2012, 07:22
Post: #14
RE: A specific color to transparent
(Jan 2, 2012 02:55)quailrancher Wrote:  Alas, Photobucket won't pick up the Gimp image. Maybe I'll go back to my old version of Photoshop and see what I can stumble across. Many thanks for the effort.
You can attach it here...

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 2, 2012, 17:15
Post: #15
RE: A specific color to transparent
Serves me right for using the quick reply.


Attached File(s)
.xcf  Copy of Copy of Harley Blackline transparent.xcf (Size: 3.01 MB / Downloads: 50)
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Desaturate to color KWiK 2 90 Oct 9, 2017 22:14
Last Post: KWiK
  Silhouette with a transparent background Rachela 0 35 Oct 1, 2017 17:06
Last Post: Rachela
  Fill Transparent selection with another section rhods85 0 48 Sep 30, 2017 16:07
Last Post: rhods85
  Removing color from multiple images Aquilo 6 2,894 Sep 28, 2017 12:56
Last Post: angel0sdh
  Image color vs color picker YalithKBK 1 211 Jul 7, 2017 11:45
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS