# Image Padding

This function block adds a constant-color border (padding) around an image. Use it to create margins, unify image sizes, or prepare images for concatenation and layout tasks without altering the original content.

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

`Input Image` The image to which padding will be applied.

`Padding Size` A number specifying how many pixels to add (applied according to the chosen side).

`Color` A pixel color value (B, G, R) used as the padding fill color. If not provided, black is used.

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

`Padded Image` The resulting image with the added padding.

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

`Padding Side` Choose which side(s) the padding should be applied to. Available options

* `ALL`
* `VERTICAL`
* `HORIZONTAL`
* `LEFT`
* `RIGHT`
* `TOP`
* `BOTTOM`

This control determines where the padding pixels are added relative to the input image.

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

* Fixed-color border applied anywhere around the image.
* Flexible side selection to pad only needed edges.
* Accepts a pixel color input so you can match backgrounds or highlight margins.

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

1. Provide an image to `Input Image`.
2. Enter the number of pixels in `Padding Size` to define the border width.
3. Optionally feed a color into `Color` (format: (Blue, Green, Red)). If left empty, the padding will be black.
4. Select the desired side with `Padding Side` and run the scenario to get `Padded Image`.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When executed, this block returns the image with the padding applied according to the chosen side, size, and color. Use the output directly in downstream visualization or processing blocks.

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

* To make multiple images the same canvas size for visual comparison, first use `Image Resize` to match heights or widths, then use this block to add symmetric padding so all images align visually.
* If you want to focus on a cropped region and then add a background, combine `Image ROI Select` (to crop) → this block (to add border) → `Show Image` to preview the result.
* To create margins before combining images side-by-side, add padding and then use `Image Concatenate` or `Collage Images` to assemble a clean layout.
* Use `Make Image` to create a colored background and then use this block when you need extra margins that match a specific background color.
* Save padded results automatically by connecting `Padded Image` to `Image Logger` or `Image Write`.

(hint) When providing color, remember the system expects pixel values in BGR order.

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

* If the padding appears in an unexpected color, confirm the `Color` input is provided as (Blue, Green, Red) and values are within 0–255.
* If no change is visible, ensure `Padding Size` is greater than zero and that the correct `Padding Side` option is selected.
* When combining many images after padding, check final alignment with `Show Image` to verify spacing and border consistency.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/image-transformations/operations/image-padding.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
