Nodes/MTB Nodes/Extract Coordinates From Image (mtb)
ComfyUI Node Runs on cloud

Extract Coordinates From Image (mtb)

Turn bright spots into points

By melMass·Created 3 years ago·Updated about a month ago· 723
Extract Coordinates From Image (mtb)
  • image
  • mask
  • BATCH_COORDINATES
  • IMAGE
threshold0.50
max_points50

This is a niche but clever little converter: it looks at an image (or a mask), finds the bright regions above a threshold you set, and spits out a list of 2D point coordinates. You go from "a picture where some pixels are lit" to "a set of x/y points" - which is exactly the input format a lot of point-driven tools want.

Where this is useful: anything that takes points rather than a picture. Feeding click-style point prompts to a segmenter, driving particles or trajectories in an animation, placing markers, or turning a heatmap of "interesting regions" into discrete locations. It's the bridge between the image world and the coordinate world, and it works across a batch of images at once.

How it works

It thresholds the input - every pixel brighter than your cutoff is a candidate - then collects those positions as points, capping the count so you don't drown in thousands of them. It also draws the found points onto an image so you can see what it picked, which is genuinely helpful for tuning.

The inputs that matter

  • threshold (default 0.5, range 0–1) - the brightness cutoff. Pixels above it count as points, below it are ignored. This is the main dial: raise it to keep only the brightest, most confident spots; lower it to catch fainter regions (at the risk of noise).
  • max_points (default 50) - a hard cap on how many points come back. Keeps the output manageable and predictable when a region is large or busy.
  • image (optional) and mask (optional) - the source to extract from. Feed a mask when you want points from a segmented region, or an image when brightness itself is the signal.

Two outputs: BATCH_COORDINATES is the list of points (batched, so it handles a stack of images), and IMAGE is a visualization with the points drawn on, for eyeballing whether your threshold is sane.

How to install it

ComfyUI Manager: search MTB Nodes (comfy_mtb), install, restart. Or manually: cd ComfyUI/custom_nodes && git clone https://github.com/melMass/comfy_mtb and restart. Pure Python - nothing to download.

Common issues

The big tuning trap is threshold. Set it too low and a noisy or gradient-filled image floods you with points until you hit the max_points cap, giving you a meaningless scatter. Set it too high and you get nothing back. Use the visualization output to dial it in - turn the threshold until the drawn points land where you actually want them, then trust it.

The second thing is knowing what consumes BATCH_COORDINATES. It's MTB's own coordinate type, so it wires cleanly into nodes designed to accept it; a node from another pack expecting a different point format won't necessarily take it directly. Check that whatever you're feeding actually wants this type. And decide deliberately whether to feed the image or the mask input - a clean mask gives far more predictable points than a busy full-color image, where all sorts of bright pixels compete for the threshold.

Categorymtb/coordinates

Inputs (4)

NameTypeDefaultDescription
thresholdFLOAT0.500–1
max_pointsINT50
imageoptIMAGE
maskoptMASK

Outputs (2)

NameTypeDescription
BATCH_COORDINATESBATCH_COORDINATES
IMAGEIMAGE