Nodes/ComfyUI-Apt_Preset/Coordinate_Generator
ComfyUI Node

Coordinate_Generator

Type up to five points instead of clicking them

By cardenluo·Created 2 years ago·Updated 17 days ago· 309
Coordinate_Generator
    • coordinates
    output_count5
    x10.00
    y10.00
    x20.00
    y20.00
    x30.00
    y30.00
    x40.00
    y40.00
    x50.00
    y50.00

    Most of Apt_Preset's coordinate nodes assume you're clicking on an image to pick points interactively. Coordinate_Generator is for the opposite case: you already know exactly where you want your points - from a spec, from math you did elsewhere in the graph, from a previous run you're reproducing - and clicking would just be slower and less precise than typing.

    What it is and why you'd reach for it

    This is part of ComfyUI-Apt_Preset's ImgCoordinate family, the set of nodes that pass point/region data around the graph as normalized JSON instead of image tensors. Where Coordinate_fromImage and Coordinate_loadImage give you a click-to-place canvas, Coordinate_Generator gives you plain number fields - useful when you're scripting a workflow, reproducing exact coordinates across runs, or need sub-pixel-precise placement that a mouse click on a scaled-down preview can't reliably give you.

    How it works

    You get five point slots, each a pair of normalized x/y floats (0.0–1.0), and output_count controls how many of those five actually make it into the output - set it to 3 and only points 1–3 get included, regardless of what's sitting in slots 4 and 5. Every one of the ten coordinate fields carries the author's own tooltip confirming what it is: "Point N's X/Y coordinate (0.0–1.0)" - so if you're not sure which field is which, the tooltip text in the node itself is authoritative.

    Inputs and outputs that matter

    • output_count (required, 1–5, default 5) - how many points from the list below actually get emitted.
    • x1/y1 through x5/y5 (required, 0–1 floats) - the point coordinates, normalized to image dimensions. You'll typically only fill in as many pairs as output_count calls for; the rest are ignored.

    Output: a single coordinates STRING - the same {x, y, index} JSON format every other node in the ImgCoordinate family reads, ready to feed Coordinate_MarkRender for a visual check, Coordinate_pointCombine to merge with other point sets, or anything downstream that consumes this pack's coordinate format.

    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
    

    Run install.bat on Windows to pull dependencies; on Linux/Mac install the requirements by hand since there's no equivalent script bundled. No models to download - this node is just arithmetic and string formatting.

    Common issues

    The most common mistake with this node isn't a bug, it's forgetting to raise output_count after filling in a fourth or fifth point - the defaults will happily let you set x4/y4 to something meaningful and then leave output_count at a value that excludes them, and the point silently doesn't appear in the output. If a downstream node seems to be missing a point you swear you set, check that number first.

    Beyond that, since every value here is normalized 0–1, it's easy to paste in a pixel coordinate by mistake (say, 847 for an x value meant to be 0.847) - the field will accept it since nothing in the schema clamps it hard, but anything downstream expecting a fraction will place your point far outside the visible frame.

    Like the rest of this pack, Apt_Preset is large and under active development, and at least one user has reported an IMPORT FAILED error at ComfyUI startup after installing it - check the console log if any Apt_Preset node, including this one, doesn't show up in your node search.

    CategoryApt_Preset/image/ImgCoordinate

    Inputs (11)

    NameTypeDefaultDescription
    output_countINT51–5输出的坐标点数量 (1-5)
    x1FLOAT0.000–1点1的X坐标 (0.0-1.0)
    y1FLOAT0.000–1点1的Y坐标 (0.0-1.0)
    x2FLOAT0.000–1点2的X坐标 (0.0-1.0)
    y2FLOAT0.000–1点2的Y坐标 (0.0-1.0)
    x3FLOAT0.000–1点3的X坐标 (0.0-1.0)
    y3FLOAT0.000–1点3的Y坐标 (0.0-1.0)
    x4FLOAT0.000–1点4的X坐标 (0.0-1.0)
    y4FLOAT0.000–1点4的Y坐标 (0.0-1.0)
    x5FLOAT0.000–1点5的X坐标 (0.0-1.0)
    y5FLOAT0.000–1点5的Y坐标 (0.0-1.0)

    Outputs (1)

    NameTypeDescription
    coordinatesSTRING