Location From Mask β‘π ‘π π £π
Turn a mask into a trackable point
- masks
- depth_maps
- LOCATION
RyanOnTheInside's pack has a whole sub-system for "proximity" effects - things that react based on where something is, or how close two things are. Before you can do anything proximity-based, you need an actual location. This node gets you one by reading it straight off a mask: paint or generate a mask around your subject, and this pulls out a LOCATION - a coordinate you can then feed into the pack's transform and proximity nodes.
How it works
Two extraction methods: mask_boundary gives you a location based on the mask's edges (useful when you care about the extent of the masked region, not just its middle), and mask_center gives you the centroid - the mask's center of mass. If you also have depth maps for your sequence, wiring them into the optional depth_maps input lets the node pull a z-coordinate too, turning a flat 2D mask position into a rough 3D location (near/far, not just x/y). That's the same depth-driven trick behind the pack's "Depth Chamber" style workflows - using a depth map to give 2D content a sense of position in space.
This is one of several "Sources" nodes that feed the pack's proximity system a LOCATION - the sibling node LocationFromPoint gives you one from manually-typed coordinates instead, for when you don't have (or don't want to derive from) a mask.
The inputs and output
masks(required,MASK) - the input mask(s) to extract a location from. Works on a sequence, so a location can track frame to frame if your mask does.method(required, enum) -mask_boundaryormask_center.depth_maps(optional,IMAGE) - depth data for a z-coordinate; skip it and you get a location with no meaningful z.
Output is a single LOCATION - wire it into LocationTransform to animate it, or into whatever else in the pack consumes a LOCATION.
How to install it
The pack's README came back empty when I checked for install-specific notes. Standard path for the whole suite:
ComfyUI Manager: search "RyanOnTheInside", install, restart.
Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
Restart ComfyUI. This pack is broad - audio, masks, proximity, and more - so extra dependencies on first install are normal, not a red flag.
Troubleshooting
LOCATION is a custom type this pack defines itself, so it will only plug into other nodes from the same pack - don't expect it to wire into a generic ComfyUI position input, there isn't one. If your extracted location jumps around erratically frame to frame, check your mask first: a noisy or flickering mask (common with auto-generated segmentation on video) produces a noisy centroid, especially with mask_center. Smoothing or cleaning up the mask upstream (or switching to mask_boundary if that's steadier for your case) usually helps more than anything on this node itself. And if z stays flat at zero despite wiring in depth_maps, double-check the depth map sequence actually lines up frame-for-frame with your masks - mismatched batch lengths are the usual culprit.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| masks | MASK | Input masks to extract locations from | |
| method | COMBO | Method to extract locations ('mask_boundary' or 'mask_center') | |
| depth_mapsopt | IMAGE | Optional depth maps for z-coordinate extraction |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LOCATION | LOCATION | β |