Nodes/ComfyUI-Gemini-Spatial/Gemini Spatial to Coords
ComfyUI Node

Gemini Spatial to Coords

Gemini points, cleaned into pixel coordinates you can actually use

By nova452·Created 3 months ago·Updated 3 months ago· 0
Gemini Spatial to Coords
  • image
  • coords_json
  • match_count
json_output[]
labelcenter

When you run GeminiSpatialNode in Points mode, it doesn't give you rectangles - it gives you single locations. A point for where the thing is, in Gemini's 0–1000 normalized coordinate space. That's the format a vision model likes to emit, but it's not the format the rest of your graph wants. This node is the tiny adapter that turns it into plain pixel coordinates: [{"x": 512, "y": 340, "label": "face"}].

It's a small, single-purpose glue node, and it doesn't pretend to be more than that. You run it because you asked Gemini where, not how big.

How it works

Feed it the json_output string from GeminiSpatialNode (Points mode) plus the image. The node parses the JSON - it tolerates markdown fences around the response, same as its box-handling sibling - flattens anything oddly nested, filters the detections by label, and converts each [y, x] point from 0–1000 into real pixel coordinates using your image's dimensions. It needs the image input purely for the width and height; no pixels are read or drawn.

Two outputs:

  • coords_json - a JSON string of {"x", "y", "label"} objects in pixel space.
  • match_count - how many points matched your label. Your first debugging step is always this number.

The inputs

  • json_output - the point detections from GeminiSpatialNode. Default "[]".
  • image - for dimensions only.
  • label - substring filter, comma-separated allowed, default "center". That default matches Gemini's point-mode convention of tagging a location point "center"; if you ran the upstream node with a custom target, match whatever label you asked for instead.

What you'd do with the output

Coordinates go anywhere that wants an x,y. A control point for positioning, a crop anchor, a value to feed into a region-conditioning or attention-focus node - or just a data string you hand to a workflow that computes camera or layout math from positions. If you need a mask instead of a point, this isn't your node; that's the GeminiSpatialBBoxNode path with task_type set to boxes.

Gotchas

The label filter is the whole failure surface. Wrong label, zero matches, match_count 0 - so check the raw json_output before you blame the conversion. Also remember the upstream analysis only looked at the first image of a batch, so the coordinates you get are for frame zero, not whatever frame you were thinking of.

Install is the pack install: ComfyUI Manager → search ComfyUI-Gemini-Spatial, or git clone https://github.com/nova452/ComfyUI-Gemini-Spatial into custom_nodes and restart. No models, no extra downloads - it's pure number-crunching on JSON that a previous API call produced.

CategoryGemini/Spatial

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
json_outputSTRING[]
labelSTRINGcenter

Outputs (2)

NameTypeDescription
coords_jsonSTRING
match_countINT