> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/image-transformations/transformation-filters/floodfill.md).

# FloodFill

This function block fills enclosed regions in an image starting from a seed point, based on color similarity. It works with grayscale or color images and provides an easy slider to control how permissive the fill should be.

## 📥 Inputs (sockets) <a href="#inputs" id="inputs"></a>

`Input Image` The source image to apply the fill on (grayscale or color).

`Seed Point (X,Y)` Optional. The starting coordinate for the fill. If not provided, the block will use the image center.

`Fill Color (R,G,B)` Optional. The color used to fill the selected region. If left empty, a default green fill is used.

## 📤 Outputs (sockets) <a href="#outputs" id="outputs"></a>

`Image` The resulting image with the filled area applied.

## 🕹️ Controls (widgets) <a href="#controls" id="controls"></a>

`Fill Range` Horizontal range slider to set lower and upper tolerance for color differences. Increasing the range makes the fill accept larger color variations around the seed; decreasing it restricts fill to pixels very similar to the seed.

## 🎯 Features <a href="#features" id="features"></a>

* Works with both grayscale and color inputs — grayscale images are automatically handled so you can use the block in either case.
* Optional seed point and fill color allow quick interactive use or fully automated pipelines.
* Visual output includes the filled region overlaid on the original image so you can immediately inspect results.
* Simple, single-slider control for fine-tuning how aggressively the region grows.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

When the block runs it:

* Uses the provided seed point to start a region fill. If no seed is supplied it defaults to the image center.
* Uses the `Fill Range` values to decide which neighboring pixels are similar enough to be included in the fill.
* Applies the chosen fill color (or default) to the selected region and outputs the modified image.

## 📝 Usage <a href="#usage" id="usage"></a>

1. Connect your image to `Input Image`.
2. Optionally provide a `Seed Point (X,Y)` to target a specific region; otherwise let it use the center.
3. Optionally provide `Fill Color (R,G,B)` to choose the fill color, or leave empty for the default.
4. Adjust `Fill Range` until the filled region matches your expectation.
5. Inspect the result from the `Image` output.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* Use `Blur` before this block to smooth noise so small variations do not interrupt fill growth.
* Use `Image Threshold` or `HSV Filter` to isolate the target region first — this can make fill results more reliable on noisy or multi-colored backgrounds.
* Crop to a region of interest using `Image ROI Select` or `Image ROI` before filling to limit operations and speed up processing.
* After filling, preview results with `Show Image` and save them with `Image Write` or `Image Logger` if needed.
* If the fill spreads too far, reduce the tolerance using `Fill Range`. If it does not reach the full region, increase the tolerance.
* For color targets, try converting or isolating colors with `HSV Filter` then feed the result to this block for a more consistent fill.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No visible change: check the seed point placement and ensure the target region is within image boundaries; preview the input with `Show Image`.
* Fill leaks into unwanted areas: lower the `Fill Range` tolerance or pre-process with `Image Threshold`/`Blur` to reduce similar colors outside the intended region.
* Unexpected color result: verify the `Fill Color (R,G,B)` values and preview the color on a sample image before running the full pipeline.
