Nodes/ComfyUI-StableManifoldCompander/SMC Extract Masked Crop
ComfyUI Node

SMC Extract Masked Crop

Cut the masked region out with breathing room, ready to detail elsewhere.

By xmarre·Created 6 months ago·Updated 6 months ago· 0
SMC Extract Masked Crop
  • image
  • mask
  • crop_image
  • crop_mask
  • region
  • summary
padding64
round_to16

SMC Extract Masked Crop (class SMCExtractMaskedCrop) is the front half of the pack's masked-crop detailing workflow. You give it an image and a mask; it finds the mask's bounding box, pads it out so the crop has breathing room, rounds the dimensions to a clean multiple, and hands you the crop, an aligned crop mask, and a little region object that remembers exactly where it came from.

This is the pattern the whole pack is built around: detail the crop at high resolution, correct the drift, then paste it back seamlessly. Crop-paste detailing is the standard ComfyUI way to fix a face or a region - it's the same trick Impact Pack's FaceDetailer uses under the hood - and this node is the manual, mask-controlled version of the "crop" step.

Inputs

  • image - the full frame.
  • mask - the region to crop. Any mask shape works; the node takes the bounding box.
  • padding (0–2048, default 64) - extra pixels added around the mask bbox on all sides. 64 is a reasonable default for face-size regions; too little and your detail pass will struggle at the edges, too much and you're re-detailing the background.
  • round_to (1–256, default 16) - the crop dimensions round to a multiple of this, so the crop plays nice with models and VAEs that want multiples of 16.

Outputs

  • crop_image - the padded region, ready for your upscale/detail/edit pass.
  • crop_mask - the mask, resized to match the crop, so it lines up pixel-for-pixel when you paste.
  • region - an SMC_REGION object recording the crop's x1,y1,x2,y2, source dimensions, and batch index. This is what SMC Composite Crop needs to put things back.
  • summary - a string like (32,48)-(800,848) 768x800 for quick reading.

Install & gotchas

Install via ComfyUI Manager (search "Stable Manifold Compander") or:

cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-StableManifoldCompander

No extra dependencies. The one hard limit worth knowing before you build a workflow: batch size 1 only. Feed it a batched image and it throws ValueError: SMC Extract Masked Crop currently supports batch size 1 only. So no batching multiple crops in one call - if you're detailing several faces, run the node per mask, or switch to something like Impact Pack's Detailer (SEGS) which handles multiple regions natively. Also worth noting: the mask gets resized to the image's dimensions internally, so if your mask was drawn at a different resolution, expect it to be snapped to the image size.

CategoryStableManifoldCompand

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
maskMASK
paddingINT640–2048
round_toINT161–256

Outputs (4)

NameTypeDescription
crop_imageIMAGE
crop_maskMASK
regionSMC_REGION
summarySTRING