> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-docs-partner-nodes-consolidate.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TripoSplatPreprocessImage - ComfyUI Built-in Node Documentation

> This node crops each input image to a centered square on a black background and adds padding to reach the specified output size.

This node crops each input image to a centered square on a black background and adds padding to reach the specified output size. It is designed to prepare images for the TripoSplat 3D model by ensuring consistent square framing and optional alpha matte erosion to prevent border artifacts.

## Inputs

| Parameter      | Description                                                                                                                | Data Type | Required | Range                    |
| -------------- | -------------------------------------------------------------------------------------------------------------------------- | --------- | -------- | ------------------------ |
| `image`        | The input image(s) to preprocess.                                                                                          | IMAGE     | Yes      | -                        |
| `mask`         | Alpha mask for the image, used to determine the crop region.                                                               | MASK      | Yes      | -                        |
| `erode_radius` | Erode the alpha matte by this pixel radius before cropping (avoids border bleed). Default: 1. Set to 0 to disable erosion. | INT       | Yes      | 0 to 16                  |
| `size`         | Square image size. The model is trained at 1024; other sizes run but are off-distribution. Default: 1024.                  | INT       | Yes      | 256 to 4096 (step of 16) |

**Note:** The `mask` input is required and must be provided. If the mask has a different batch size than the image, it is automatically repeated to match. If the mask dimensions differ from the image dimensions, the mask is resized to match the image using bilinear interpolation. The output size is automatically rounded down to the nearest multiple of 16 (minimum 16) to ensure compatibility with DINOv3 patch and Flux2 VAE stride requirements. The node raises an error if the mask contains no foreground pixels (empty mask). When `erode_radius` is 0, no erosion is applied. The square crop is centered on the mask's alpha bounding box and sized to 1.2 times the larger bounding box dimension; any area outside the image bounds is filled with black.

## Outputs

| Output Name | Description                                                                                                                    | Data Type |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------ | --------- |
| `image`     | The preprocessed image(s) cropped to a centered square on a black background with padding, at the requested `size` resolution. | IMAGE     |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/TripoSplatPreprocessImage/en.md)

***

**Source fingerprint (SHA-256):** `ec66941846398ee6637576b11ae9d2f9576f6b05ed2ef730cdbf99a68fe9b838`
