Inkscape

Bucket Fill Tool

The Bucket Fill Tool is simple - it fills in unfilled areas with color.  Being a vector tool, however, Inkscape's Paint Bucket actually creates a new path that "fills in" the area in which you clicked.

It is important to note that the tool's operation perceptual, not geometric. That is, when looking for the boundaries around the point you clicked, it takes for such boundaries any visible color changes. This means that filling will stop at gradients, blurs, and even the color boundaries in imported bitmaps, but will ignore any paths or other objects that are fully (or almost fully) transparent or for any other reason do not stand out from the background. In short, it will work exactly as if you were filling a rasterized version of your image in a bitmap editor like Photoshop or GIMP - but will give you a vector object to work with.

Internally, the tool works by performing a bitmap-based flood fill on a rendered version of the visible canvas, then tracing the resulting fill using potrace and placing the traced path into the document.

It places the rendered path onto the current layer, so you can have a layer on top (for example, "Inks") and select the layer below ("Colors") and do the fills so that they always appear below the Inks.

Because the tool operates in this way, you can, for example, scan a pencil sketch, import the bitmap into Inkscape, and quickly fill all its cells with colors without tracing the bitmap first. This is a very convenient and interactive way of digitizing your paper drawings, making the traditional bitmap tracing unnecessary in many cases.

The resolution of the bitmap image used to perform the trace is dependent upon your current zoom level -- the more 'zoomed in' to an area that you are, the higher the resolution of the bitmap-based flood fill. So, if you have a fill that is too imprecise, has rough corners, or doesn't go where it is supposed to go, just undo it (CTRL + z ), 'zoom in' closer and repeat filling from the same point. Conversely, if the fill leaks out through a small gap, zoom out to make the gap less visible and fill again (or use the auto gap closing parameter - see below).

PaintFill 

How to use

The Paint Bucket Tool works fairly intuitively: click in any area bounded on all sides and it will fill it with color - or, in reality, a path which can be filled and adjusted like any arbitrary path.

Style

Like all object-creating tools, the Paint Bucket may use the last-set style for the objects it creates (this is the default), or it can use its own fixed style. You can switch between these modes on this tool's page in Inkscape Preferences (Ctrl+Shift+P). As in all other tools, the style swatch on the far right of the Controls Bar shows the style that will be used for the next fill object you create. 

Controls

In the Tool Controls bar: Paint Bucket's perceptual fill can use either all visible colors or specific color channels. Using the Fill by drop-down list, you can restrict the fill algorithm to one the following channels:

  • Red
  • Green
  • Blue
  • Hue
  • Saturation
  • Lightness
  • Alpha

The Threshold (in per cent units) controls how large the color difference must be at a point (compared to the initial click point) to stop the fill. 'Zero tolerance' means only an area which is strictly the same color will be filled; the larger the tolerance, the easier it will be for the fill to leak into adjacent different-color areas. The default value is 10%.

Using the Grow/shrink by parameter, you can control the amount of inset/outset to be applied to the created fill path. Setting a positive outset causes fill paths to be larger than the filled bitmap area (good for eliminating anti-aliasing errors), while setting a negative outset causes the path to be smaller. This works much the same as the Outset and Inset path commands, except it's done automatically after every fill.

With the Close gaps parameter, you can make the Paint Bucket tool ignore any gaps in the area boundaries that would normally cause the fill to spill out of the desired area. There are four settings to auto gap:

  • None
  • Small (close gaps up to 2 pixels in size)
  • Medium (4 pixels)
  • Large (6 pixels)
Note : setting this parameter to anything other than None may slow down Inkscape noticeably while filling large areas.

Hotkeys

The tool's shortcuts are:

  • Single click performs filling from the click point.
  • Shift+click performs filling from the click point and then unions the resulting path with the selected path. This way, if your first attempt did not fill in all of the desired area, you can Shift+click the remaining corner to fill it in separately and combine the result with the result of the previous fill.
  • Ctrl+click on an object simply changes that object's fill to the current fill color of the tool, and Shift+Ctrl+click changes the stroke to the current stroke color.
  • Click+drag performs filling from all of the points that you pass while dragging (you will see your path visualized by a red line). From each point, the fill spreads to its neighbours with the colors similar to that point - in other words, it's like clicking with this tool at each point of the drag path and joining the results. This lets you easily fill an area occupied by a gradient or blur - just drag from the darkest to the lightest points in the area you want to fill.
  • Alt+click and drag works similarly to simple drag, except from each point of the drag path, the fill spreads to the neighbours (if any) with the colors similar to the initial point (the point where you started the drag). This lets you fill a series of similarly-colored yet separated areas (for example, multiple cells in a cartoon) by starting the drag in one of those areas, and Alt+dragging the tool through all the other areas.