ComfyUI > Nodes > Bjornulf_custom_nodes > 🖼➜🔲 Image to grayscale (black & white)

ComfyUI Node: 🖼➜🔲 Image to grayscale (black & white)

Class Name

Bjornulf_GrayscaleTransform

Category
Bjornulf
Author
justUmen (Account age: 3046days)
Extension
Bjornulf_custom_nodes
Latest Updated
2025-02-28
Github Stars
0.2K

How to Install Bjornulf_custom_nodes

Install this extension via the ComfyUI Manager by searching for Bjornulf_custom_nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Bjornulf_custom_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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

🖼➜🔲 Image to grayscale (black & white) Description

Converts color images to grayscale using luminosity method, preserving alpha channel for transparency.

🖼➜🔲 Image to grayscale (black & white):

The Bjornulf_GrayscaleTransform node is designed to convert color images into grayscale, a process that can be particularly useful in various artistic and technical applications where color information is either unnecessary or distracting. This node utilizes the luminosity method to achieve the grayscale transformation, which is based on human perception of color, ensuring that the resulting image maintains a natural and visually appealing balance of light and dark areas. By focusing on the relative luminance of the red, green, and blue channels, this method provides a more accurate representation of how humans perceive brightness. The node also offers the flexibility to preserve the alpha channel, which is crucial for maintaining transparency in images that require it. This feature makes the Bjornulf_GrayscaleTransform node a versatile tool for artists and designers who need to manipulate images while retaining essential transparency information.

🖼➜🔲 Image to grayscale (black & white) Input Parameters:

image

The image parameter is the primary input for the node, representing the image data that you wish to convert to grayscale. This parameter accepts images in a format that includes RGB channels, and optionally an alpha channel if transparency is present. The image should be provided as a tensor with dimensions that include the color channels, typically in the format of (batch, height, width, channels). There are no specific minimum or maximum values for this parameter, as it is dependent on the image data being processed.

preserve_alpha

The preserve_alpha parameter is a boolean option that determines whether the alpha channel of the input image should be retained in the output. When set to True, the node will preserve the transparency information from the original image, ensuring that any transparent areas remain unchanged in the grayscale output. This is particularly useful when working with images that require transparency, such as overlays or icons. The default value for this parameter is False, meaning that by default, the alpha channel will not be preserved unless explicitly specified.

🖼➜🔲 Image to grayscale (black & white) Output Parameters:

IMAGE

The IMAGE output parameter represents the resulting grayscale image after the transformation process. This output maintains the same dimensions as the input image, ensuring compatibility with subsequent processing steps. If the preserve_alpha parameter is set to True, the output will include the alpha channel, allowing for transparency to be retained. The grayscale image is generated using the luminosity method, which provides a balanced and perceptually accurate representation of the original image's brightness levels.

🖼➜🔲 Image to grayscale (black & white) Usage Tips:

  • To achieve the best results when converting images with transparency, ensure that the preserve_alpha parameter is set to True to maintain the alpha channel in the output.
  • Use this node to preprocess images for tasks that require grayscale input, such as certain types of image analysis or artistic effects that focus on texture and contrast rather than color.

🖼➜🔲 Image to grayscale (black & white) Common Errors and Solutions:

Unsupported image shape

  • Explanation: This error occurs when the input image does not have the expected number of channels, typically when the image is not in the format of (batch, height, width, channels).
  • Solution: Ensure that the input image is correctly formatted with the appropriate number of channels, including the alpha channel if necessary.

Image tensor dimension mismatch

  • Explanation: This error can happen if the input image tensor does not match the expected dimensions, such as missing the batch dimension.
  • Solution: Verify that the input image tensor includes all required dimensions, and add a batch dimension if processing a single image.

🖼➜🔲 Image to grayscale (black & white) Related Nodes

Go back to the extension to check out more related nodes.
Bjornulf_custom_nodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.