# Slice Image

This function block splits an input image into a grid of smaller sub-images. Use it to break large images into tiles for individual analysis, parallel processing, or to generate image galleries.

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

`Image Any` - Main image to be sliced.

`Horizontal Percentage` - Number of horizontal slices (columns). If empty, defaults to 1.

`Vertical Percentage` - Number of vertical slices (rows). If empty, defaults to 1.

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

`Image Any` - The main image with optional visual hints (same as input or annotated version).

`Sliced Images` - List of the generated sub-images (each tile from the grid).

`Sliced Coordinates` - List of rectangle coordinates for each slice (useful to map results back to the original image).

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

This block uses the above inputs as its adjustable parameters. Provide values for `Horizontal Percentage` and `Vertical Percentage` to control the grid layout.

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

* When evaluated, the block reads the provided `Image Any` and the two slice number inputs.
* It divides the image into a grid using the specified number of columns and rows.
* The block outputs the full image, a list of individual slice images (in reading order), and the coordinates for each slice so you can relate detections back to the original image.

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

* Easy grid-based slicing without needing manual cropping.
* Returns both slice images and their coordinates for downstream processing.
* Works with any image size; slices are computed to evenly cover the image area.

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

1. Connect an image producer (camera, file loader, etc.) to `Image Any`.
2. Set the desired number of columns via `Horizontal Percentage`.
3. Set the desired number of rows via `Vertical Percentage`.
4. Run the scenario: the block will output the tiled images and their coordinates for further processing.

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

* Combine with `Show Image` to preview individual tiles quickly by connecting one element from `Sliced Images` into a display workflow.
* Use `Image Resize` or `Image Resizer` before slicing if you need uniform tile sizes or want to reduce processing time.
* Feed each tile into detection blocks such as `Find Object`, `Object Detection`, or `Mask Detection` to run per-tile analysis and then use `Sliced Coordinates` to map results back to the original image.
* After per-tile processing, use `Collage Images` or `Image Concatenate` to create a single visual summary from the processed tiles.
* To save results per tile, connect `Sliced Images` to `Image Logger` or `Multi Image Write` for organized export.

(hint) If you only need a single region instead of a grid, consider using `Image ROI Select` or `Image ROI` before slicing to limit the area.

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

* If tiles appear stretched or unexpected, try adding `Image Resize` before the block to enforce consistent source dimensions.
* If you receive fewer tiles than expected, check that `Horizontal Percentage` and `Vertical Percentage` are set to integers greater than 0.
* If downstream detectors miss objects at tile borders, add a small overlap by resizing or pre-cropping with `Image ROI` and then slicing, so objects crossing boundaries are captured in at least one tile.


---

# 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/slice-image.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.
