Post Reply 

Bucket fill effect on alpha channel

Dec 17, 2010, 01:16
Post: #1
Bucket fill effect on alpha channel
Hi,

I'm new to gimp forums and relatively new to gimp.

I have a PNG logo that has anti-aliased letters on a transparent background. In other words, all pixels are white (for example) and either 0% tranparent (in the letters) or semi-transparent (in the anti-aliasing). The rest of the image is transparent.

What I'm trying to do is take change the color of the logo. Bucket fill in normal mode changes the alpha value of the semi-transparent pixels to 0% transparent when applying the color--so I loose the anti-aliasing. I did manage to get what I want with bucket fill mode Darken only, but this only works for certain colors on certain other colors (I can change white to any other color, but not vice versa).

Is there a straightforward way to fill a color while keeping the alpha channel intact? I tried all the modes, and also modifying the Fill transparent areas, but don't really understand them to figure out if one does this in the general case.
Find all posts by this user
Quote this message in a reply
Dec 17, 2010, 01:53
Post: #2
RE: Bucket fill effect on alpha channel
Apply the bucket-fll to the selection, after doing an "alpha to selection" on the layer.

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
Dec 17, 2010, 08:32
Post: #3
RE: Bucket fill effect on alpha channel
Slightly better method (the previous one may leave minutes bits of the original color):

- add new layer, filled with required color
- on original layer: alpha to selection
- back to new layer, invert selection and erase
- delete original layer

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
Dec 17, 2010, 19:42
Post: #4
RE: Bucket fill effect on alpha channel
Hi Ofnuts,

Thanks for the two suggestions, but they don't quite work. I had played with the Alpha to selection before, but I never got it to work quite right. The way it does the selection, it leaves out some of the anti-aliasing (some of the semi-transparent pixels).

If I do it twice (using Add to selection the second time) it looks like it grabs exactly what I want--but why twice? What that tells me is that the selection it is doing has some sort of threshold but not one I can adjust--thus I can never know exactly what it's doing.

Your second method doesn't work right, even if I add to selection in the second step. Something in the inverting and erasing adds extra pixels to my outlines in a way I don't understand (the pixels exist in the part I deleted--how can that be?). So actually, your first method works the best if I do Add to selection.

Actually, the Darken Only and Lighten Only modes on the bucket fill seem to work the best, and that's just a single click. But it still feels like a workaround that may not work in all cases (for example if my logo were multicolored to begin with). I think the problem is that the other modes don't handle the alpha channel correctly (or clearly). It seems like there should be a mode to Preserve Alpha.
Find all posts by this user
Quote this message in a reply
Dec 19, 2010, 00:02
Post: #5
RE: Bucket fill effect on alpha channel
I'm looking at the source code and the bit that does color-to-alpha (as well as the "color erase" mode of some paint tools) has some strange side-effects indeed. In fact there is no clear definition of what "erasing a color" does :-) To complicate the matter anti-aliasing on a layer is handled with transparency, but when it's applied to as single plane it's really a color mix (with change of hue if there is a colored background).

Something else that will work if your background is white or transparent and your current antialiasing is using the same hue on all pixels and only plays with value/saturation:

- Make a rough selection around the logo if you have other things to protect
- Set the bucket-fill too in "hue" mode (one of the last) and the FG color to whatever
- Bucket fill the selection: in hue mode the pixels will have their hue replaced by the one from the FG color, leaving saturation & value unmodified. Since white is any hue with full saturation & value, the white background won't be impacted. You can also use the brush that, for the same reason, will miraculously leave the background untouched.

This "hue" mode is really nice when it works, because the hue of most objects is constant, shadows and reflections only change the saturation and value. So you can paint them over in a new hue while keeping the texture of the original image...

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
Feb 2, 2011, 02:54
Post: #6
RE: Bucket fill effect on alpha channel
Windows->Dockable Dialogs->Layers
Check 'Lock alpha channel' box for the layer and use normal bucket fill
Find all posts by this user
Quote this message in a reply
Feb 2, 2011, 13:15
Post: #7
RE: Bucket fill effect on alpha channel
(Feb 2, 2011 02:54)marina Wrote:  Windows->Dockable Dialogs->Layers
Check 'Lock alpha channel' box for the layer and use normal bucket fill
Learn something new every daySmile Thx.

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
Jun 12, 2013, 04:22
Post: #8
RE: Bucket fill effect on alpha channel
(Feb 2, 2011 02:54)marina Wrote:  Windows->Dockable Dialogs->Layers
Check 'Lock alpha channel' box for the layer and use normal bucket fill
Assuming this is the box (chain link icon) just to the right of the layer visibility (eye icon) box, it seems to have no effect on bucket fill in GIMP 2.8.2 for Windows.

However, I found a solution: select area you want to change colour, then Colors menu -> Colorify. Did exactly what I wanted with an image made of just white pixels and alpha channel as seemingly described in the OP. HTHS.
Find all posts by this user
Quote this message in a reply
Jun 12, 2013, 07:18
Post: #9
RE: Bucket fill effect on alpha channel
Nope... alpha lock is here:

   

(this is a 2.6 version, in 2.8 you also have the pixel lock)

"Selecting the area" (except alpha to selection if they are on their own layer) by about any means doesn't take the edge pixels in account properly. To keep the edges clean, you have two solution:
1) full selection of all the pixels and keep their opacity (which is what the alpha-lock method does)
2) progressive selection of the pixels matching opacity (alpha-to-selection) and then, on a clean layer, bucket fill the selection. The layer should be clean, otherwise, due to the partial selection along the edges, the new color will be blended with the old one and th edge pixels will keep a bit of their former color.

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
Jun 16, 2013, 22:38 (This post was last modified: Jun 17, 2013 03:40 by fryerlawrence.)
Post: #10
RE: Bucket fill effect on alpha channel
        [attachment=2131][attachment=2132][attachment=2129][attachment=2130]Uhhhh ummmm need help....lol

I have tried everything listed and still cannot get the paint bucket to work. I am trying to edit plane liveries for a flight game that I am playing.

I just today started learning to get into the Alpha channels. I think I may have toggled something that I cannot find or see if there is a switch to be flipped...lol

I am working with "Channels" and "Layers tabs in the "Channels" tool window. When I think I have everything back to normal. I am choosing the Paint Bucket > clicking on the only layer in the "Channels" tab > then I go to use the Paint Bucket. It acts like it does something but the only layer that was highlighted in blue (to notate selection) my selected layer that is highlighted disappears and nothing happens. I do click CTRL + Z just to make sure I am not doing something in the background that I cannot see.



Thanks for the help in advance,
-fryer

[Image: flying-pig-rocket-to-the-moon-or-bust_2_zps119f0e3a.jpg] “With sufficient thrust, pigs fly just fine.” -Unknown Author
Find all posts by this user
Quote this message in a reply
Jun 17, 2013, 00:13
Post: #11
RE: Bucket fill effect on alpha channel
Your screenshots are too small to see anything. You can attach them here directly (just use the full editor to get the necessary controls), if possible fullscale and in PNG format.

Check in the "Channels" list if by any chance you have a Channel selected, in which case you are applying the bucket-fill to the channel and not to the layer.

To draw clean lines you have better use the brush (even a hard brush) instead of the pencil. this will give clean edges to your lines(*). Use layers, lots of. Base paint, markings, all that should be on several layers. Keep the basic template layer unchanged, the paint can be on a layer above it, set to "multiply" mode.

(*) or even better use the Path tool and stroke the lines.

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
Jun 17, 2013, 03:22 (This post was last modified: Jun 17, 2013 03:53 by fryerlawrence.)
Post: #12
RE: Bucket fill effect on alpha channel
Sorry about that... I think I got the screenshots on the right attachment...lol

Am gonna check based on what you said in the meantime.

Follow up question about brushes... This image that I am working with has thousands of pixels... I am assuming that is the way that Microsoft Studios made it in the first place.

Basically what I am trying to do is re-color the plane and also add some decals. I could of used your advice when I was working on my other project. I made a C-46 Curtiss Commando Flyin' Whale (an Orca... aka Shamu...lol)

Thanks,
-fryer


Attached File(s) Thumbnail(s)
   

[Image: flying-pig-rocket-to-the-moon-or-bust_2_zps119f0e3a.jpg] “With sufficient thrust, pigs fly just fine.” -Unknown Author
Find all posts by this user
Quote this message in a reply
Jun 17, 2013, 03:22
Post: #13
RE: Bucket fill effect on alpha channel
Sorry about that... I think I got the screenshots on the right attachment...lol

Am gonna check based on what you said in the meantime.

Thanks,
-fryer

[Image: flying-pig-rocket-to-the-moon-or-bust_2_zps119f0e3a.jpg] “With sufficient thrust, pigs fly just fine.” -Unknown Author
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Can't fill outside of text box? Vorpike 4 177 Sep 23, 2014 05:38
Last Post: Vorpike
  Color to alpha really weird Sagemode 15 445 Sep 16, 2014 05:49
Last Post: Sagemode
  Alpha channel from inverted selection WhyDoIHaveToCreateAnAccount 3 178 Aug 31, 2014 19:12
Last Post: WhyDoIHaveToCreateAnAccount
  Fill with picked colour qim 8 267 Aug 30, 2014 07:13
Last Post: qim
  Alpha channel? Diriel 12 437 Aug 13, 2014 19:51
Last Post: iForStyle007

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS