A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
The LayerUtility: Number Calculator node is part of the ComfyUI Layer Style utility library. This node functions as a basic arithmetic and comparison calculator within ComfyUI workflows, allowing users to perform various mathematical operations between two inputs, a
and b
. The result of these operations is provided in both integer and float formats.
The primary role of the Number Calculator node is to perform mathematical operations on two given inputs. This node supports a variety of operations, which can be selected based on the user's requirement.
The Number Calculator node accepts the following inputs:
a: The first input value. This value can be any numeric type (integer or float).
b: The second input value. Similar to a
, this can also be any numeric type.
operator: This determines the operation to be performed on a
and b
. The available operators include:
+
: Addition-
: Subtraction*
: Multiplication/
: Division**
: Exponentiation (raising a
to the power of b
)//
: Floor Division%
: Modulus (remainder of the division)nth_root
: Calculates the nth root of a
(a
raised to the power of 1/b
)min
: Minimum of a
and b
max
: Maximum of a
and b
The node provides two outputs upon execution:
int: The result as an integer. This is most relevant when whole numbers are expected or required in the workflow.
float: The result as a floating-point number, providing a more precise output, particularly useful when dealing with non-integer results.
The LayerUtility: Number Calculator node is flexible enough to be used in numerous scenarios where arithmetic operations are needed. Some possible uses include:
Zero Division Handling: The division (both regular and floor) operations ensure that an attempt to divide by zero results in an output of zero instead of causing an error. This feature helps maintain robust workflows without unexpected interruptions.
Decimal Precision: Outputs are given in both integer and float formats to accommodate varying precision needs, allowing for a flexible workflow integration.
Versatile Operator Selection: The node is capable of handling various mathematical operations, simplifying tasks that require arithmetic manipulations without needing multiple nodes.
This comprehensive functionality makes the Number Calculator node a valuable component in creating complex workflows within ComfyUI, enabling precise and efficient calculations as part of broader data and visualization tasks.