InstantID Mask Prepare Settings (JPS)
Getting the mask right before InstantID touches a face
- imageprepare_settings
Before InstantID applies a face onto a generation, something upstream usually needs to decide where that's allowed to happen - a mask constraining the identity injection to a specific region rather than letting it influence the whole frame. This node is the settings hub for building that mask: where it comes from, how it's resized and positioned to match your target canvas, and a bit of cleanup on the way out. Like this pack's other Settings nodes, it doesn't do the mask work itself - pair it with the matching Pipe node and wire the unpacked values into whatever's actually generating and using the mask.
What it's for, in context
InstantID is the zero-shot, one-photo face adapter that made "do I even need a character LoRA anymore" a real question back in early 2024 - it reads an InsightFace ArcFace embedding for identity and adds a ControlNet-style module (IdentityNet) that conditions on facial landmarks, which is why it holds a face's geometry across poses better than a plain IP-Adapter FaceID does. It's an SDXL-family tool (works on Illustrious and Pony too, since they're SDXL underneath) with no Flux path - the ecosystem's identity role on Flux went to PuLID instead. Worth knowing up front if you're building this into anything commercial: InstantID's checkpoints are research-only and the InsightFace models underneath are non-commercial, so no amount of permissive licensing on the surrounding code changes that.
The inputs that matter
mask_type- six options: No Mask, Mask Editor, Mask Editor (inverted), or pulling the mask from the Red, Green, or Blue channel of an image. That last trio is a cheap, deliberate trick: paint a mask into one color channel of a reference image in any editor and extract it here, rather than needing ComfyUI's mask editor for every pass.resize_to- Resize to Target, Resize to Source, or Keep Size. Whether the mask gets scaled to match a target canvas, to match the source image's own dimensions, or left alone.resize_type- Crop or Stretch, for how the resize actually happens when the aspect ratios don't match.offset_width/offset_height(-99 to 99) andcrop_left/crop_right/crop_top/crop_bottom(0–90) - fine positioning and cropping controls once the base resize choice is made.padding_left/padding_right/padding_top/padding_bottom(0–500) - add blank space around the mask, useful if your target canvas is larger than the source and you need the mask centered within it rather than stretched to fill it.interpolation(lanczos, nearest, bilinear, bicubic, area, nearest-exact) - the resize method. Nearest is usually the safer choice specifically for masks, since blending interpolation methods can introduce soft, gray edge pixels a binary mask shouldn't have.sharpening(0–1, default 0) - a mild sharpen after resize, more relevant to the underlying image than the mask itself.
Output: imageprepare_settings, typed BASIC_PIPE - JPS's own bundle (a plain tuple under the hood, unrelated to Impact Pack's object of the same type name), meant for a matching Pipe node.
Installing it
ComfyUI Manager: search JPS Custom Nodes for ComfyUI. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/JPS-GER/ComfyUI_JPS-Nodes.git
Restart ComfyUI, removing any earlier copy of the pack first. This node itself needs no models, but the InstantID workflow it's built for does - an InstantID checkpoint, an InsightFace-based face model, and the ControlNet-shaped IdentityNet weights, none of which come from this pack. Get those from whichever InstantID node pack you're running (the reference implementation is InstantX/InstantID). This specific node is also newer than the pack's published README, so don't expect to find it in that document's list.
Where people get tripped up
If your mask isn't lining up with your target image, the fix is almost always resize_to/resize_type before it's the offset or crop values - get the base scaling behavior right first, then nudge with offsets. And remember interpolation choices like lanczos or bicubic can leave soft gray edges on what should be a hard-edged mask; if downstream behavior looks like the mask boundary is "leaking," try nearest instead. Beyond that, this node only prepares data - the actual InstantID application (loading the checkpoint, running IdentityNet, applying the mask) happens in separate nodes elsewhere in your graph.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_type | COMBO | 6 options: No Mask, Mask Editor, Mask Editor (inverted), Red from Image, Green from Image, Blue from Image | |
| resize_to | COMBO | 3 options: Resize to Target, Resize to Source, Keep Size | |
| resize_type | COMBO | 2 options: Crop, Stretch | |
| offset_width | INT | 0-99–99 | — |
| offset_height | INT | 0-99–99 | — |
| crop_left | INT | 00–90 | — |
| crop_right | INT | 00–90 | — |
| crop_top | INT | 00–90 | — |
| crop_bottom | INT | 00–90 | — |
| padding_left | INT | 00–500 | — |
| padding_right | INT | 00–500 | — |
| padding_top | INT | 00–500 | — |
| padding_bottom | INT | 00–500 | — |
| interpolation | COMBO | 6 options: lanczos, nearest, bilinear, bicubic, area, nearest-exact | |
| sharpening | FLOAT | 0.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| imageprepare_settings | BASIC_PIPE | — |