Gimp-Forum.net
bucket fill right to the edge? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: bucket fill right to the edge? (/Thread-bucket-fill-right-to-the-edge)



bucket fill right to the edge? - tolworthy - 12-07-2018

Hi! I'm making a browser game, with simple graphics drawn in the GIMP. and hit a problem with the GIMP fill tool.

Imagine I have a black circle (in outline, on white). I use the fill tool to fill the circle with red. When the fill tool finds an off-white pixel, it either fills it totally or not at all, depending on the threshold setting. So the red either eats into the outline (only the purest black pixels remain, looking narrow and jagged) or leaves a white-ish outline.

Is there any way to fill the circle so that off-white pixels are tinted instead or replaced? So that the red fades into black? I know the best solution is not to create the image that way in the first place. But I am editing existing images. I wish I could just click "fill" and have a nice result. Any suggestions?


RE: bucket fill right to the edge? - tolworthy - 12-08-2018

Just for reference, I found a solution: Krita has a more advanced fill tool. Don't worry, I still use the Gimp for everything else Smile


RE: bucket fill right to the edge? - Blighty - 12-08-2018

Just in case tolworthy comes back.

There is a way to do this in Gimp.

If you have a black circle on a white background there are anti-aliasing pixels between the black and white. These are shades of grey. It is important to preserve these anti-aliasing pixels.

Summary of method:
1) Use Fuzzy select to select the white inside the circle.
2) Grow the selection by 1 or 2 pixels
3) Create a new transparent layer below your image.
4) On this new layer, bucket fill the selection with red
5) Select the top layer again
6) Colours > Colour to Alpha and accept the default white

Colour to Alpha preserves the anti-aliasing pixels.


RE: bucket fill right to the edge? - Espermaschine - 12-08-2018

(12-08-2018, 08:04 AM)Blighty Wrote: 6) Colours > Colour to Alpha and accept the default white

A variation of this step is to set the b/w layer (aka lineart) to 'Multiply'. 
In comparison to Colour-To-Alpha its non-destructive.


RE: bucket fill right to the edge? - tolworthy - 12-08-2018

(12-08-2018, 08:04 AM)Blighty Wrote: Just in case tolworthy comes back.

There is a way to do this in Gimp.

If you have a black circle on a white background there are anti-aliasing pixels between the black and white. These are shades of grey. It is important to preserve these anti-aliasing pixels.

Summary of method:
1) Use Fuzzy select to select the white inside the circle.
2) Grow the selection by 1 or 2 pixels
3) Create a new transparent layer below your image.
4) On this new layer, bucket fill the selection with red
5) Select the top layer again
6) Colours > Colour to Alpha and accept the default white

Colour to Alpha preserves the anti-aliasing pixels.

That's great to know! Many thanks!


RE: bucket fill right to the edge? - Ofnuts - 12-08-2018

1) remove the current color with color-to-alpha. If necessary, make a fuzzy selection on the background and and grow it by one or two pixels so that it covers the edge pixels. Off-white pixels will be partially transparent
2) bucket-fill with the new color (using the same selection) using the bucket-fill tool in Behind mode. This will complement the partiall transparent pixels with the new color

The Gimp fill tool is advanced enough once you have read the doc Smile