ComfyUI Node

2🐕Local Image

The tiny crop node that keeps ControlNet honest

By 11dogzi·Created 2 years ago·Updated 2 years ago· 27
2🐕Local Image
  • reference_image
  • image
  • mask
  • IMAGE
  • MASK
region_extension50
partial_size512

EGCYQJBCJ - "2🐕Local Image" - is the unglamorous helper in this pack, and it's the one that makes the Local sampler usable with ControlNet. ControlNet is spatial: the control image it sees has to match the geometry of what you're sampling, pixel for pixel. When EGCYQJB (2🐕Local sampler) crops down to your mask and samples a 512-ish patch, your lineart still spans the whole frame - so the control and the sample are talking about different pictures. This node fixes that by cropping the control image to the same region, using the same mask, before you feed it to ControlNetApply.

How it works

Pure geometry, no AI in the loop. It resizes your image and mask to match reference_image (that's the coordinate frame), finds the bounding box of the mask's white pixels, pads it by region_extension, crops, then scales the crop so its short side equals partial_size. Two outputs: the cropped IMAGE and the matching cropped MASK. The pack's bundled workflow shows the intended chain: lineart from a preprocessor → this node → ControlNetApply → the Local sampler's positive conditioning. Crop both the control and the region and they line up again.

The inputs

  • reference_image: the image whose size defines the coordinate space. Feed the same image you masked.
  • image: the control image to crop - lineart, depth, pose, whatever your ControlNet is conditioning on.
  • mask: the same mask the sampler is using. An empty mask here is handled gracefully; it just returns the resized image and mask unchanged.
  • region_extension (50) and partial_size (512): mirror the Local sampler's knobs. Keep them in sync with the sampler or your crop and sample regions drift apart.

Installing it

Same pack, same install:

cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-samplers

or ComfyUI Manager → search "Comfyui-ergouzi-samplers", then restart. No dependencies beyond what ComfyUI already ships, no model downloads.

Gotchas

Set partial_size to match the Local sampler's Partial_size - if they disagree, the control gets scaled to a different resolution than the sampled region and the conditioning turns mushy. And if your mask and image aren't the same size, the node silently resizes both to the reference first, so double-check the reference is the frame you actually masked. That's the whole list. It's a dumb node, and being dumb is its job.

Category2🐕sampler

Inputs (5)

NameTypeDefaultDescription
reference_imageIMAGE
imageIMAGE
maskMASK
region_extensionINT50
partial_sizeINT5120–2048

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK