Subtraction:
Subtraction is an image-processing node whose default formula subtracts one image from another. This can help you explore differences between images, such as where an edit changed colors or brightness. The formula is editable, so the node is not limited to the default subtraction expression. The provided class defines the interface but does not show how formulas are executed or how their results are converted into images; details such as clipping and display behavior cannot be confirmed from this source.
Subtraction Input Parameters:
formula
A required, multiline text field that specifies the calculation. Its default is ``result = imga
- imgb
, which expresses subtraction of the second image from the first. Changing the order changes the calculation:imga - imgbandimgb - imga`` are different results. No minimum or maximum length, alternative options, or other formula rules are specified in the provided class.
imga
An optional IMAGE input used as the first image in the default formula. Its tooltip also calls it the “Reference size” input and states Default =(1,512,512,3). That describes a stated default shape, not a minimum or maximum image size; the provided class does not show how the default image is created or used when this input is unconnected.
imgb
An optional IMAGE input used as the image subtracted from imga in the default formula. Supplying a different image changes the calculated difference. The provided class specifies no default value, minimum or maximum size, or behavior when this input is unconnected.
Subtraction Output Parameters:
image
The node’s sole output is named image and has type IMAGE. It is intended to carry the image produced by the formula for viewing or use in another image node. With the default formula, its underlying calculation is ``imga
- imgb``; the provided class does not establish how values outside the usual display range are handled, so the displayed image should not be treated as a precise numerical difference without checking the underlying implementation.
Subtraction Usage Tips:
- Start with the default formula and connect both image inputs when comparing two images. Use images with matching dimensions to avoid shape-mismatch problems.
- Keep the subtraction order intentional: place your reference in
imgaand the image you want to subtract inimgbwhen usingresult = imga - imgb. - For a straightforward comparison, change only the connected images before editing the formula. This makes it easier to tell whether an unexpected result comes from the images or the expression.
- Inspect the output in a viewer before relying on subtle differences. The provided source does not specify how negative or out-of-range subtraction values will appear.
Subtraction Common Errors and Solutions:
Formula evaluation error
- Explanation: This is an illustrative error category, not a confirmed message from this node. A mistyped expression or an invalid formula could prevent execution; the provided class does not show its evaluator or exact error text.
- Solution: Restore
result = imga - imgband check spelling, operators, and image connections before making further edits.
Image size or shape mismatch
- Explanation: This is an illustrative error category, not a confirmed node message. Subtracting images with incompatible dimensions may fail during the calculation or produce an unintended result.
- Solution: Resize or prepare both images to the same width, height, and channel arrangement before connecting them.
Missing image input
- Explanation: Both image connections are marked optional, but the default formula refers to
imgaandimgb. The provided class does not show what happens when either is unconnected. - Solution: Connect both images when using the default formula. If you intend to leave one unconnected, verify the node’s actual fallback behavior first.
Unexpectedly dark or unusual output
- Explanation: Subtraction can produce values below zero or outside a normal display range. The provided class does not show whether those values are clipped, transformed, or handled another way.
- Solution: Check that the images are in the intended order, then compare with a simple pair of test images. Consult the node’s execution implementation before interpreting displayed colors as exact difference values.
