ComfyUI > Nodes > Masquerade Nodes > Unary Image Op

ComfyUI Node: Unary Image Op

Class Name

Unary Image Op

Category
Masquerade Nodes
Author
BadCafeCode (Account age: 485days)
Extension
Masquerade Nodes
Latest Updated
2024-06-19
Github Stars
0.34K

How to Install Masquerade Nodes

Install this extension via the ComfyUI Manager by searching for Masquerade Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Masquerade Nodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Unary Image Op Description

Perform various single-operand image operations for AI art projects, including inversion, averaging, rounding, clamping, and absolute value transformations.

Unary Image Op:

The Unary Image Op node is designed to perform a variety of single-operand operations on images, making it a versatile tool for image manipulation in your AI art projects. This node allows you to apply different transformations such as inversion, averaging, rounding, clamping, and taking the absolute value of the image's pixel values. These operations can be particularly useful for preprocessing images, enhancing visual effects, or preparing images for further processing in your workflow. By providing a straightforward interface for these common image operations, the Unary Image Op node helps streamline your creative process and ensures consistent results.

Unary Image Op Input Parameters:

image

The image parameter is the input image on which the unary operation will be performed. This image should be in a tensor format, typically representing pixel values normalized between 0 and 1. The image serves as the primary data that will be manipulated by the selected operation.

op

The op parameter specifies the type of unary operation to be applied to the input image. The available options are:

  • invert: Inverts the pixel values of the image, turning light areas dark and vice versa.
  • average: Computes the average value of the image's pixels and applies this average across the entire image.
  • round: Rounds the pixel values to the nearest integer.
  • clamp: Clamps the pixel values to be within the range of 0 to 1. - abs: Takes the absolute value of the pixel values, removing any negative values.

Unary Image Op Output Parameters:

IMAGE

The IMAGE output parameter is the resulting image after the specified unary operation has been applied. This output will be in the same tensor format as the input image, with pixel values adjusted according to the chosen operation. The output image can then be used in subsequent nodes for further processing or final rendering.

Unary Image Op Usage Tips:

  • To create a negative of an image, use the invert operation, which can be useful for certain artistic effects or preprocessing steps.
  • Use the average operation to create a uniform image based on the average pixel value, which can serve as a baseline or reference image.
  • The round operation is helpful when you need to convert floating-point pixel values to integers, such as when preparing images for certain types of quantized processing.
  • Apply the clamp operation to ensure that all pixel values remain within the valid range of 0 to 1, which can prevent artifacts in subsequent processing steps.
  • The abs operation is useful for removing negative values from an image, which can be important in certain mathematical transformations or when dealing with signed pixel values.

Unary Image Op Common Errors and Solutions:

Invalid operation <operation_name> for unary image op

  • Explanation: This error occurs when an unsupported operation name is provided to the op parameter.
  • Solution: Ensure that the op parameter is set to one of the supported operations: invert, average, round, clamp, or abs.

Input image tensor is not in the correct format

  • Explanation: This error occurs when the input image tensor is not properly formatted or normalized.
  • Solution: Verify that the input image is a tensor with pixel values normalized between 0 and 1. Ensure that the image dimensions are correctly specified.

Operation failed due to incompatible image dimensions

  • Explanation: This error occurs when the image dimensions are not compatible with the selected operation.
  • Solution: Check the dimensions of the input image and ensure they are appropriate for the chosen operation. For example, the average operation requires a 3D tensor with height, width, and channel dimensions.

Unary Image Op Related Nodes

Go back to the extension to check out more related nodes.
Masquerade Nodes
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.