ComfyUI Node Runs on cloud

Integer

A whole-number value, and a float→int converter

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Integer
    • INT
    Value1

    DF_Integer is Derfuu's whole-number variable node - you set a number and it outputs an INT. Widths, heights, offsets, step counts, batch sizes: all the things in ComfyUI that must be integers rather than decimals. It does a second useful job too: because its widget accepts a float but its output is typed INT, it doubles as a quick float-to-integer converter, which is exactly what you need at the end of a math chain that produced something like 1023.99.

    How it works

    You type a value into the widget (it steps by 1) and the node emits it as an INT. If a float feeds a chain that lands on this node, the decimal part is dropped in the conversion to a whole number. So it's both a constant-integer source and a rounding-to-int endpoint depending on how you use it.

    The inputs and outputs that matter

    • Value (numeric widget, default 1, steps of 1) - the number you set. The widget is float-typed but the node produces a clean integer.
    • Output: INT - a whole number, wired into width/height/offset/step inputs that reject decimals.

    Where it fits

    This is the node that closes the loop on Derfuu-style dimension math. You compute a size with Multiply / Divide / Power (all of which output floats), then land on Integer to turn the result into a pixel dimension the sampler or a latent node will accept. It's also a plain constant when you just need "512" or "20 steps" driving several nodes from one place. If you want explicit rounding behavior - always up or always down - use Ceil or Floor instead, which are unambiguous about direction.

    How to install it

    ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart. By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes
    

    then restart. No dependencies, no models - plain Python.

    Common issues & troubleshooting

    Your value got truncated unexpectedly. Converting a float to an int drops the fractional part rather than rounding to nearest, so 2.99 can become 2. If you want it rounded up, put a Ceil before it; for nearest-behavior control, do the rounding explicitly upstream.

    Dimensions need to be multiples of 8. That's a diffusion constraint, not this node's - many models want width/height divisible by 8 (or 64). Compute accordingly; an odd integer here will still be an odd integer downstream.

    Do you need it? Native ComfyUI has a Primitive int node now, and lots of packs provide integer constants. DF_Integer persists mostly because old workflows use it - for something new, the built-in primitive avoids the dependency.

    Red node after updating the pack. Derfuu has removed deprecated nodes on updates instead of keeping them, so old graphs can reference names that vanished - reconnect a fresh copy. A ModuleNotFoundError mentioning Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep exactly one, named Derfuu_ComfyUI_ModdedNodes.

    CategoryDerfuu_Nodes/Variables

    Inputs (1)

    NameTypeDefaultDescription
    ValueFLOAT1

    Outputs (1)

    NameTypeDescription
    INTINT