🖊️ Image Canvas Placer
The outpaint pad node that grows the background from the image's own edges
- image
- mask
- image
- original_mask
- expand_mask
- bg_image
- edge_expand_image
- help_text
Outpainting starts with a boring chore: put your image on a bigger canvas, mask the empty area, and hope the model extends it without a seam. yiuImgCnvPlacer is the boring chore turned into one node - and then it goes a step further. Instead of leaving you with a flat black pad, it grows a background from the image's own edge pixels, which is a much better starting point for the inpaint pass than a void.
This is the workhorse of the pack's outpainting use case: you have a product or a scene reference, you want a bigger canvas around it, and you want to control exactly where the original sits on that canvas. Think print layouts, e-commerce scenes, or extending a photo you like without re-generating it from scratch.
How it works
Three things happen. First, the image (and its mask, if you give one) is scaled and placed on a canvas at your chosen resolution and position - x_pos/y_pos are percentages of the remaining space, so 50/50 centers it, 100 pushes it to the right or bottom edge. Second, an expand_mask is built: a mask that's white over the empty extension area and black over the original image, with a Gaussian-feathered edge (blurred at feather_radius × 2, then level-adjusted so the soft gray shoulder becomes white). That mask is exactly what an inpaint/outpaint node wants as its mask input. Third, the clever part: edge_expand_image samples the colors along the image's border, bins them by angle, and radially interpolates them in HSV out across the canvas - so the extension looks like the image just continues, not like a colored rectangle.
The inputs that matter
- image - the image to expand. The author's tooltip says to cut it out first (feed a transparent cutout) so the edge sampling has a real subject to work from.
- mask - optional, but worth feeding: it gets placed alongside the image and comes back out as original_mask for inpaint-style workflows.
- resolution - 24 SDXL/FLUX aspect-ratio presets (
1024x1024,1536x1024, etc.), overridable with width_overwrite/height_overwrite. - x_pos / y_pos (0–100), scale (1–100), scale_ref_canvas (true = 100% means "fit the canvas"; false = 100% means "original size").
- hex_color and feather_radius - the solid-fill fallback color and the feather width in px.
Outputs
- image - the placed image on a transparent canvas.
- original_mask - the input mask, repositioned with the image.
- expand_mask - the outpaint region mask. Wire this into your inpaint node.
- bg_image - composite on the solid hex color.
- edge_expand_image - composite with the radial edge-extended background. Usually the one you want to actually feed to the model.
Installing it
Part of yiu_comfy_nodes by leizingyiu. ComfyUI Manager → search yiu_comfy_nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/leizingyiu/yiu_comfy_nodes
Restart after. No extra dependencies, no model downloads.
Where people get burned
- Three-digit hex is rejected here.
#000errors out; the node's ownparse_hex_colordemands a full#RRGGBB. Its sibling yiuFitItm2Msk accepts short hex, so this inconsistency catches people who copy a color across. - No mask means no protection. Without an input mask,
original_maskcomes back all zeros, so if your inpaint passes are mask-driven you've lost your keep-region. Feed the cutout's mask. - Feather too big bleeds the mask.
feather_radiusis in pixels, not percent - 20 is a sane default; cranking it to hundreds will soften the protected zone into the extension area.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| mask | MASK | — | |
| resolution | COMBO | 1024x1024 | 24 options: 1600x1024, 1536x1536, 1536x1024, 1344x768, 1280x768, 1152x896, +18 |
| width_overwrite | INT | 0 | — |
| height_overwrite | INT | 0 | — |
| x_pos | FLOAT | 50.000–100 | — |
| y_pos | FLOAT | 50.000–100 | — |
| scale | FLOAT | 100.01–100 | — |
| scale_ref_canvas | BOOLEAN | true | — |
| hex_color | STRING | #000000 | — |
| feather_radius | INT | 200–16384 | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| original_mask | MASK | — |
| expand_mask | MASK | — |
| bg_image | IMAGE | — |
| edge_expand_image | IMAGE | — |
| help_text | STRING | — |