Nodes/JPS Custom Nodes for ComfyUI/InstantID Mask Prepare Pipe (JPS)
ComfyUI Node

InstantID Mask Prepare Pipe (JPS)

Unpack the mask-prep bundle

By JPS-GER·Created 3 years ago·Updated 2 years ago· 100
InstantID Mask Prepare Pipe (JPS)
  • imageprepare_settings
  • mask_type
  • resize_to
  • resize_type
  • offset_width
  • offset_height
  • crop_left
  • crop_right
  • crop_top
  • crop_bottom
  • padding_left
  • padding_right
  • padding_top
  • padding_bottom
  • interpolation
  • sharpening

Pairs with InstantID Mask Prepare Settings (JPS) - the node that decides where InstantID's identity injection is allowed to apply, by building a mask (from ComfyUI's mask editor, or pulled from a color channel of a reference image) and configuring how it gets resized and positioned to match your target canvas. This pipe takes that bundle apart again, dropped wherever downstream actually consumes the individual values.

What comes out of it

One input, imageprepare_settings - a BASIC_PIPE (JPS's own bundle, a plain tuple, not Impact Pack's object of the same type name). Fifteen outputs:

  • mask_type (INT) - which of six mask sources to use: no mask, the mask editor (regular or inverted), or the red/green/blue channel of a reference image.
  • resize_to (INT) - resize to target, resize to source, or keep the mask's original size.
  • resize_type - Crop or Stretch, for how a resize actually happens when aspect ratios don't match.
  • offset_width / offset_height, crop_left / crop_right / crop_top / crop_bottom, padding_left / padding_right / padding_top / padding_bottom - fine positioning, cropping, and padding once the base resize strategy is chosen.
  • interpolation - the resize algorithm. Nearest is usually the right call specifically for masks, since blending interpolation methods leave soft gray edges a binary mask shouldn't have.
  • sharpening (FLOAT) - a mild sharpen pass, more relevant to the reference image a channel-extracted mask came from than the mask itself.

This node runs no masking logic itself - it's pure routing, handing each value to whatever downstream node actually builds and applies the mask before it reaches InstantID's identity-injection step.

Installing it

Ships with the pack. ComfyUI Manager: search JPS Custom Nodes for ComfyUI, install, restart. Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git

Restart afterward, deleting any earlier copy of the pack first. This node itself needs no models - but the InstantID pipeline it's built for does: an InstantID checkpoint and InsightFace's ArcFace models, both under a research/non-commercial license, so keep that in mind before building anything commercial around this workflow.

Where people get tripped up

Without an InstantID Mask Prepare Settings (JPS) node upstream, this pipe has nothing to unpack.

Watch the wiring more carefully than usual on this one. The input, imageprepare_settings, is a name several other Settings nodes in this pack reuse for their own outputs - Image Prepare Settings (JPS), InstantID Pose Prepare Settings (JPS), and InstantID Source Prepare Settings (JPS) all produce a BASIC_PIPE under that exact same label. Because BASIC_PIPE carries no schema ComfyUI actually validates, this pipe will accept a wire from any of those nodes without complaint - the connection looks correct in the UI. It won't unpack right, though: this pipe expects fifteen fields in a specific order, starting with mask_type, and a Settings node built for a different purpose (say, Image Prepare Settings, which has no mask_type or resize_type at all) will produce misaligned or nonsensical output values rather than a clean error. If the mask you're generating doesn't match what you configured, trace the imageprepare_settings wire back to confirm it's actually coming from Mask Prepare Settings and not one of its similarly-named cousins.

CategoryJPS Nodes/Pipes

Inputs (1)

NameTypeDefaultDescription
imageprepare_settingsBASIC_PIPE

Outputs (15)

NameTypeDescription
mask_typeINT
resize_toINT
resize_typeCrop,Stretch
offset_widthINT
offset_heightINT
crop_leftINT
crop_rightINT
crop_topINT
crop_bottomINT
padding_leftINT
padding_rightINT
padding_topINT
padding_bottomINT
interpolationlanczos,nearest,bilinear,bicubic,area,nearest-exact
sharpeningFLOAT