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
  pick color and use renato07 1 80 Feb 22, 2018 15:24
Last Post: paynekj
  What is the best font and color combination to write on this? SonAmyFan362 2 93 Jan 23, 2018 16:17
Last Post: SonAmyFan362
  silver color pamopar 2 4,145 Nov 22, 2017 06:01
Last Post: georgemacin
  Color alpha function and its current errors Fuse809 0 343 Oct 11, 2014 03:53
Last Post: Fuse809
  GIMP 2.8 Eyedropper Color Selection Tool Not Working? Upgraded App is Slow?? tootallll 13 10,871 Oct 9, 2014 18:39
Last Post: Graphicman2014

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS