Coordinate_create_mask
A rectangular mask from four normalized numbers
- image
- mask
- image
Sometimes you don't need a hand-painted mask, a segmentation model, or a click-to-place point picker - you just need "the middle 60% of the image" or "the top-left quadrant," and you need it fast. Coordinate_create_mask is the no-fuss version: four sliders, one rectangle, done.
What it is and why you'd reach for it
This lives in ComfyUI-Apt_Preset's ImgCoordinate family - a cluster of nodes in cardenluo's big utility pack that all pass region/point data around as normalized coordinates. Most of that family is built for clicking points on an image or extracting them from a mask; this one goes the other direction, building a rectangular mask straight from numbers. If you're doing straightforward box-region work - masking a watermark corner, isolating a header band, carving out a center-crop region for inpainting - this is faster than opening the mask editor and dragging a box by hand, especially if you want the exact same region reproduced across a batch of differently-sized images.
How it works
The four required fields - x_min, y_min, x_max, y_max - are all normalized to 0.0–1.0, meaning they're fractions of the image's width and height rather than pixels. The defaults (0.2/0.2/0.8/0.8) draw a centered box covering the middle 60% of the frame in both dimensions. Because it's fraction-based, the same node config produces a proportionally identical box whether your input image is 512px or 4096px - you don't have to recompute pixel coordinates every time your resolution changes.
Inputs and outputs that matter
image(required) - the source image; this is what the mask's dimensions are derived from.x_min/y_min/x_max/y_max(required, 0–1 floats) - the box corners. Min values are top-left, max values are bottom-right, standard image-coordinate convention (Y increases downward).
Outputs: mask, the rectangular region as a standard MASK, and a passthrough image so you can keep the original wired downstream without a separate branch. The mask wires straight into any inpainting KSampler, a Composite node, or one of Apt_Preset's own mask-compositing nodes.
Installing it
Through ComfyUI Manager: search ComfyUI-Apt_Preset, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git
Then run install.bat (Windows) to pull in dependencies before restarting ComfyUI. On Linux/Mac there's no equivalent script bundled, so you'll need to find and install the requirements manually. No model downloads are needed for this node - it's straightforward tensor math, nothing to fetch.
Common issues
Because the corners are unbounded relative to each other in the schema (nothing stops you from setting x_min above x_max), if your mask comes out empty or inverted from what you expected, check you haven't accidentally swapped a min and a max - the node likely won't error, it'll just quietly produce a degenerate or empty region.
More broadly: ComfyUI-Apt_Preset is a large, actively-updated pack with a lot of moving parts, and at least one user has reported it failing to import at ComfyUI startup after installation - a classic large multi-dependency-pack problem, not specific to this node. If Coordinate_create_mask (or anything else from Apt_Preset) shows up red or missing in your node list, check the startup console log for the actual IMPORT FAILED reason before reinstalling blind - it'll usually name a missing Python package that install.bat was supposed to handle.
If you need the mask to track a subject rather than sit at a fixed fraction of the frame - say the subject moves between images in a batch - this node isn't the tool; that's what Coordinate_fromMask or a proper detector is for. This one is deliberately dumb: same box, every time, wherever you point it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| x_min | FLOAT | 0.2000–1 | — |
| y_min | FLOAT | 0.2000–1 | — |
| x_max | FLOAT | 0.8000–1 | — |
| y_max | FLOAT | 0.8000–1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| mask | MASK | — |
| image | IMAGE | — |