0

I have this image:

enter image description here

I want to selectively fill in some of the contiguous white regions bounded by black lines. My plan for doing this so far was to somehow turn the regions into selections then use the paint bucket to fill in regions. Stuck at first step. How can I do the first step or otherwise achieve the objective in GIMP?

1

You don't need to make any selections to use the Paint Bucket tool. It has that functionality built in.

  • Open the image, and create a new transparent layer above.

  • Zoom in.

  • Select the Paint Bucket tool, and in the Tool Options, set the "sample merged" option, and set the threshold to about 115. If the threshold is too low, you'll get white pixels left where the black lines are anti-aliased.

  • Choose a foreground colour, and click where you want to fill.

The fill will be applied to the new transparent layer, leaving the original image layer untouched. The beauty of this method is if you mess up, you can just delete the layer, and do another one.

enter image description here

  • This works great. Except for the bit about the transparent layer. I added a transparent layer above it doesn't draw onto it. When I click with the bucket tool nothing happens. If I remove the layer it works as you describe. – spinkus Jan 11 '18 at 23:16
  • You need to have the transparent layer selected in the layers palette for it to work, and choose the "Fill transparent areas" and "Sample Merged" in the tool options. I missed one of these out in my steps above, and have edited it to include that. – Billy Kerr Jan 12 '18 at 0:13
1

Use the "Magic wand". Click in the first area, and shift click in addtional areas if needed. Bucket-fill with color.

Warning: If you only do this the result will look like crap, because the anti-aliasing pixels will be either removed (jaggy lines) or left out (white halo).

So, the proper way, a bit more complex:

Step 1: make the background transparent

  • Add an alpha channel if there is none: Layer>Transparency>Add alpha channel
  • Use the "By color selector" to select the white, with a small threshold
  • Select>Grow by 1 pixel (so that the selection includes the black lines)
  • Color>Color to alpha an remove the white
  • At that point you can add a new layer, filled with white, and drag it under the layer with the lines, and this should recreate the initial image.

Step2: painting areas (slow but very clean)

  • add a transparent layer, move it to between the layer with the lines and the white background (let's call it "Painted areas")
  • Select the "lines" layer in the Layers list (ctrl-L)
  • Use the Magic wand to select the areas to paint (use shift-click to add several areas if needed)
  • Select>Grow by one pixel (so the selection includes the black lines)
  • Select the "Painted areas" layer in the Layers list
  • Bucket-fill the selection ("Fill whole selection" option) with the required color.
  • Repeat for each color

enter image description here

Your layers list should look like this:

enter image description here

Step2: painting areas (faster but a bit less clean)

  • add a transparent layer, move it to between the layer with the lines and the white background
  • Set the bucket-fill tool to "Fill contiguous areas", "Sample merged", and a somewhat high threshold (around 100).
  • Set the color and click in the areas. The tough part if finding a threshold that includes all the edge pixels (no unpainted pixels) and that doesn't cross the lines and selects several adjacent areas.

(The Layers list is identical to the one above)

  • They don't "also work well", they work better, the accepted solution seem to work well because the dark colors conveniently mitigate the jagged edges that are created. – xenoid Jan 11 '18 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.