Adds a ComfyUI custom node named Qwen-2512-ControlNet-Inpainting.
This is a drop-in alternative to ComfyUI's ControlNetInpaintingAliMamaApply for alibaba-pai/Qwen-Image-2512-Fun-Controlnet-Union. It keeps the normal ComfyUI sampler path and conditioning format; it only replaces the apply node behavior needed for the Fun ControlNet inpaint branch.
ComfyUI PR #12359 added loader/runtime support for Qwen-Image-2512 Fun ControlNet weights, but the stock AliMama inpaint apply node only passes a concat mask when control_net.concat_mask is enabled. The Fun union loader intentionally sets concat_mask=False, because the model expects its own packed context:
[control_latent(16), keep_mask(1), inpaint_latent(16)] -> 33 latent channels -> 132 packed features
This node builds that latent context up front, then attaches it as a standard CONTROL_NET to the positive and negative conditioning.
Clone or copy this folder into:
ComfyUI/custom_nodes/ComfyUI-Qwen2512ControlNetInpainting
Restart ComfyUI. The node appears as:
model/conditioning/controlnet/Qwen-2512-ControlNet-Inpainting
No extra Python packages are required.
An importable minimal outpaint workflow is included at:
examples/qwen2512_outpaint_minimal.json
It uses the normal ComfyUI KSampler path with Qwen-Image-2512-Fun-Controlnet-Union.safetensors. After importing it, select your local model filenames and replace the placeholder input.png.
For outpainting, leave control_image disconnected first. Connect it only when you also want Canny, Depth, Gray, Pose, or another explicit control branch in addition to the inpaint context.
positive,negative,control_net,vae,image,mask,strength,start_percent,end_percentmatch the stock AliMama node.imageis treated as the inpaint source image.maskfollows normal ComfyUI inpaint convention: white/1.0 means redraw this area.control_imageis optional. If connected, it is resized to matchimageat pixel resolution before VAE encoding, then becomes the Fun ControlNet control branch, useful for pose/canny/depth/gray plus inpaint. If omitted, the control branch is zeroed and the node runs pure inpaint context.debug_logis an advanced option. Enable it only when diagnosing a run; it logs whether the Fun branch was used, mask ranges, and the latent/control hint tensor shapes.
- Use ComfyUI with PR #12359 or newer, so
Qwen-Image-2512-Fun-Controlnet-Union.safetensorsloads as a Fun ControlNet. - This project targets Qwen-Image-2512 static image inpaint/outpaint workflows. It does not claim video or multi-frame support.
strengthmaps to ComfyUI's ControlNet strength. The current officialQwenFunControlNetsoftens strengths above 1 internally.- If a non-Fun ControlNet is connected, the node uses a best-effort AliMama-compatible fallback. The Qwen-Image-2512 Fun ControlNet path is the primary support target.
GPL-3.0-or-later. This project interoperates with and adapts behavior from ComfyUI's GPL ControlNet apply nodes.