ComfyUI Node Runs on cloud

Divide

DF_Divide – ComfyUI Node from Derfuu_ComfyUI_ModdedNodes

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Divide
    • FLOAT
    Numerator1.00
    Denominator1.00

    DF_Divide takes a numerator and a denominator and gives you back the quotient as a float - A / B, no more, no less. It's part of Derfuu_ComfyUI_ModdedNodes, a small math-and-utility pack that's been around since ComfyUI's early days, back when doing arithmetic between values inside a graph meant reaching for one dedicated node per operation instead of typing a formula.

    Where this one actually earns its keep is computing ratios - the thing division is for. You've read an image's real dimensions with DF_Get_image_size and want to know its aspect ratio, or you're figuring out what multiplier would scale a source size to hit a target size before feeding that number into DF_Image_scale_by_ratio or DF_Latent_Scale_by_ratio. Divide the target by the source and wire the result straight into the upscale_by or modifier input of one of those scaling nodes, and you've got a dynamic scale factor instead of a number you had to calculate by hand and hardcode.

    Inputs and output

    Two required FLOAT inputs, named plainly:

    • Numerator
    • Denominator

    One output: FLOAT, equal to Numerator / Denominator. Order matters - unlike DF_Sum, swapping the two inputs gives you a completely different number, not just a flipped sign.

    The one thing worth being careful about, as with division anywhere: if Denominator ends up at zero, your run isn't going to produce a sensible result. That's not a Derfuu-specific quirk, it's just what division does - but it's worth double-checking if your denominator is itself the output of another calculated node rather than a number you typed in, since it's easy for a chain of math nodes to land on zero without you noticing until the queue errors out.

    Where it fits

    This is a plumbing node for ratio math, most useful right before one of the pack's scaling nodes (DF_Image_scale_by_ratio, DF_Latent_Scale_by_ratio, DF_Conditioning_area_scale_by_ratio) when you want the scale factor computed from live values instead of typed in as a fixed number. If you're just scaling by a number you already know, you don't need this at all - type the ratio directly into the scaling node's widget.

    Installing

    The whole pack installs together - there's no way to grab a single node from it. Through ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart ComfyUI. Manually:

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

    then restart. Pure Python logic, no models, no unusual dependencies - the install itself is quick and rarely a source of problems.

    Troubleshooting

    If DF_Divide doesn't show up in the node menu right after installing, restart the server and hard-refresh your browser - that clears up the large majority of "installed but not visible" reports, and it's a generic ComfyUI frontend quirk, not something specific to this pack.

    Worth flagging about the pack in general: its maintainer has, in the past, removed deprecated nodes outright on updates rather than keeping a legacy-labeled version around, which has broken workflows for people who leaned on the pack heavily over time. The core math nodes, this one included, have been stable fixtures since the pack's early days and aren't the ones that have historically disappeared - but if an old workflow throws a missing-node error elsewhere after a pack update, that maintenance pattern is worth checking before assuming your ComfyUI install itself is broken.

    CategoryDerfuu_Nodes/Math

    Inputs (2)

    NameTypeDefaultDescription
    NumeratorFLOAT1.00
    DenominatorFLOAT1.00

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT