Post Reply 

Color to Alpha leaves some pixels....

Sep 13, 2012, 13:01
Post: #1
Color to Alpha leaves some pixels....
(A quick search seems to suggest that this issue is native to the Color to Alpha feature in GIMP, and so I don't know that there is a ready-made solution. Still, I thought I'd give it a shot.)

I had a .JPEG of a leaf photographed against a white background. When I went to turn that white background into a transparent alpha channel, it seemed to work okay....except for the fact that when I then went to select the new alpha channel via the Fuzzy Select Tool, it wasn't selecting all these newly transparent pixels.

Why is this and, more importantly, is there a quick way to overcome it?

[Image: Untitled-13.png]
Find all posts by this user
Quote this message in a reply
Sep 13, 2012, 15:28
Post: #2
RE: Color to Alpha leaves some pixels....
(Sep 13, 2012 15:17)ofnuts Wrote:  Likely your white wasn't completely white so C2A doesn't make these pixels 100% transparent. Not a big problem usually because they are likely at least 90% transparent, on the verge of invisible.

Rather easy to fix:
- add layer mask, and transfer the alpha channel
- either use the Curves or Levels to make the almost black pixels completely black (don't overdo it because that can create aliasing around the leaf), or use the paint brush to paint these areas in pure black
- apply mayer mask

Now, you should never have this problem because Fuzzy select or Color select are evil tools(*) that shouldn't be used. To select the transparent stuff, use Layer/Transparency/Alpha to selection and invert the selection.

(*) Fuzzy select and Color select are the disk sander and electric planer of the Gimp toolbox. They look like they do the job quickly, but they are best used by very knowledgeable people.
Alright, thanks for the instuctions as always, OfNuts.

I had already gotten around this by just amping up the Threshold of the "evil" Fuzzy Select brush. But I'll bear your solution in mind for future use, and I'm sure that many lurkers here at GimpForums will put it to use, as well. (Really, it didn't have to be perfect, anyway, I was mostly just trying to learn for future use).
Find all posts by this user
Quote this message in a reply
Sep 13, 2012, 18:19
Post: #3
RE: Color to Alpha leaves some pixels....
(Sep 13, 2012 17:51)ofnuts Wrote:  By the way... look at your leaf, it has become partially transparent as well. The right technique would have been:

- use Wand with some reasonable treshold (20-30)
- click on on background
- check all background is selected
- Select/Grow the selection enough so that it takes one-two pixels inside the leaf
- color-to-alpha
Yeah, do you know why "Color to Alpha" always seems to subtract some alpha from EVERYTHING in the image? Does it just find everything with any related RGB value and strip them of any similarities to the color being removed?

What I always end up doing when I use C2A (to borrow your acronym) is just create a transparent layer beneath it, and then a matte of the color I just removed. (So, for instance, here I removed white, and so I had a solid white area in the shape of the leaf beneath the leaf, and that prevented the semi-transparency that C2A had caused.)
Find all posts by this user
Quote this message in a reply
Sep 14, 2012, 00:10
Post: #4
RE: Color to Alpha leaves some pixels....
(Sep 13, 2012 23:42)ofnuts Wrote:  Because color to alpha does exactly what is written in the box: it replaces a color by the corresponding alpha, in other words, it computes a layer, which, placed over a background of the removed color, produces the original layer. This is why your technique works. But, it you can produce a selection for it, you have better use that selection to protect the inside of your subject, hence my usual "Wand select+grow selection" (see "background removal" link in my sig).
Okay then, that explains it. Thanks as always.
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Alpha Titan Testo : Supercharge Your Sex Life & Amplify Pleasure alphatitantesto 0 15 May 18, 2019 10:12
Last Post: alphatitantesto newtondrew 0 11 May 18, 2019 07:03
Last Post: newtondrew
  color picker problems leons 1 325 Jan 2, 2019 09:30
Last Post: paynekj
  What is the best font and color combination to write on this? genebrecht 1 739 Dec 19, 2018 21:35
Last Post: paynekj
  Increasing Color Bit Depth on Legacy files -- Does it have any immediate effect? EndWggn 2 315 Oct 29, 2018 17:41
Last Post: EndWggn

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS