Nodes/Link Comfy Nodes/Sprite Scale Calculator
ComfyUI Node

Sprite Scale Calculator

Turn a real-world size into pixel dimensions

By Mister-Link·Created 9 months ago·Updated 24 days ago· 0
Sprite Scale Calculator
    • pixel_width
    • pixel_height
    presetSpirie
    target_width_inches28
    target_height_inches63

    This one's squarely aimed at the game-dev side of this pack, alongside Pixelate, Palettize, and Spritesheet Builder. Instead of eyeballing "how many pixels should this sprite be" and picking a resolution that just feels right, it converts an intended physical size - given in inches - into the actual pixel dimensions you should generate or resize to, so your sprite work lines up with a real external scale reference instead of an arbitrary number.

    The inputs and outputs that matter

    • preset - Spirie (the default) or Custom. Spirie reads as a project-specific preset baked in by the pack's author, likely tied to whatever game or project they were originally building this for, rather than a general industry-standard default. Unless you happen to be working on that same project, you'll almost always want Custom.
    • target_width_inches (default 28) and target_height_inches (default 63) - your intended physical dimensions when Custom is selected. The defaults are tall and narrow, more in line with a character sprite's proportions than a square icon.

    Outputs: pixel_width and pixel_height - the computed pixel dimensions, ready to feed into an EmptyLatentImage, a resize node, or this pack's own Snap to Divisible if whatever you're generating for also needs the result rounded to a clean multiple.

    The node doesn't expose a DPI or scale-factor field anywhere in its inputs, so whatever conversion constant it uses between inches and pixels is baked in rather than adjustable - worth knowing going in if the numbers it hands back don't match a specific DPI target you had in mind.

    How to install it

    Search "Link Comfy Nodes" in ComfyUI Manager and install from there. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Mister-Link/link-comfy-nodes
    pip install -r link-comfy-nodes/requirements.txt
    

    Restart ComfyUI. Plain arithmetic node - nothing extra to install for it specifically.

    Common issues & troubleshooting

    Editing the inch fields with preset still set to Spirie. Those width/height fields most likely only take effect under Custom - if you're changing target_width_inches or target_height_inches and the outputs aren't budging, check that you've actually switched preset to Custom first.

    Outputs don't match your expected DPI. Since there's no exposed scale or DPI parameter, this node has an internal assumption baked in that isn't user-adjustable beyond the preset choice and the inch values themselves. If your project needs a specific, known pixels-per-inch conversion, it's worth sanity-checking this node's output against your own math once, rather than assuming it matches a particular standard.

    Feeding it a size wildly outside typical sprite scale. The field has a generous range (0–10000 inches), but that's a UI ceiling, not a guarantee the result is sensible for a game asset - absurdly large inch values will hand back absurdly large pixel dimensions with no sanity check applied.

    Categoryimage/transform

    Inputs (3)

    NameTypeDefaultDescription
    presetCOMBOSpirie2 options: Spirie, Custom
    target_width_inchesINT280–10000
    target_height_inchesINT630–10000

    Outputs (2)

    NameTypeDescription
    pixel_widthINT
    pixel_heightINT