Nodes/Orion4D_layer_manager/Paste Cropped Image
ComfyUI Node

Paste Cropped Image

Paste Cropped Image — the other half of the crop pipeline

By orion4d·Created about a month ago·Updated about a month ago· 2
Paste Cropped Image
  • cropped_image
  • image
  • mask
  • rgba_image
canvas_width1024
canvas_height1024
x0
y0
background_typetransparent
hex_color#000000

Crop a subject out of a photo and you're only halfway there. The other half is putting it back down somewhere useful - on a clean canvas, at a chosen position, with a usable alpha. That's exactly what Paste Cropped Image does, and it's built to be the partner node for Interactive Crop from the same pack. The classic flow is Load Image → Interactive Crop → Paste Cropped Image, and the two talk to each other without any math on your side.

How it works

Mechanically it's a paste-with-alpha-composite: the node builds a blank canvas of canvas_width × canvas_height, optionally fills it with a hex color, then composites your cropped image on top at x/y. If the incoming image has an alpha channel, that alpha is used for the composite and handed back as the output mask; if it's a plain RGB crop, the pasted region is treated as fully opaque. The output rgba_image is that same composite with the alpha baked into the fourth channel - ready to feed anything that consumes RGBA.

One thing it does well is not explode. Paste coordinates are clamped to the canvas, and the pasted region is clipped if it would run off the edge. Drop a crop 50px past the right border and you get a partially visible paste, not an error. The paste math also clamps values to 0–1, which quietly saves you from the occasional NaN-colored corruption that sloppy compositing code produces.

The inputs that matter

  • cropped_image - required, the IMAGE to place (typically from Interactive Crop's cropped_image output).
  • canvas_width, canvas_height - the new canvas size. Defaults to 1024×1024.
  • x, y - top-left placement in canvas pixels. These are where Interactive Crop's output_x/output_y (or crop_width/crop_height if you're sizing things up) slot in.
  • background_type - transparent (default) or hex_color. Transparent is what you want when you're building a cutout for further compositing; hex_color flattens the result onto a solid color so you get a viewable RGB image in one go.
  • hex_color - the solid fill used when background_type is hex_color. Defaults to black; it's a plain #RRGGBB string.

Outputs

Three of them, all the same paste in different packaging: image is the RGB result (transparent areas render as the background color or black), mask is the alpha - white where the crop landed, black elsewhere - and rgba_image is the true transparency-carrying version. Which one you grab depends on the next node: a mask consumer wants mask, anything that can read RGBA wants rgba_image, and a Save Image wants image.

Install

No model files, no extra Python deps - the pack runs on NumPy, Pillow and PyTorch, all present in a standard ComfyUI install:

cd ComfyUI/custom_nodes
git clone https://github.com/orion4d/Orion4D_layer_manager

Restart ComfyUI after cloning. ComfyUI Manager users can skip the terminal entirely: search Orion4D_layer_manager under "Install Custom Nodes."

Common issues

  • Paste landed in the wrong place. Check whether your crop node's coordinates are scaled. Interactive Crop's scale_multiplier scales both the image and the coordinates, which is what keeps this pair in sync - but if you feed it coordinates from a different crop tool that doesn't scale, positions drift. Prefer the two-pack.
  • Cutout pasted as a solid rectangle. That means your input has no alpha channel. If you cropped from a node that only outputs RGB, run it through an alpha/mask extraction first, or use Interactive Crop's mask-aware flow.
  • It's on a black background and you wanted transparent. Switch background_type to transparent; the image output can't show transparency, so black there is expected - grab rgba_image instead.
CategoryOrion4D_Layer

Inputs (7)

NameTypeDefaultDescription
cropped_imageIMAGE
canvas_widthINT10241–16384
canvas_heightINT10241–16384
xINT00–16384
yINT00–16384
background_typeCOMBOtransparent2 options: transparent, hex_color
hex_colorSTRING#000000

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
rgba_imageIMAGE