Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-Desert-Pixel-Nodes > DP Extract Mask

ComfyUI Node: DP Extract Mask

Class Name

DP Extract Mask

Category
DP/image
Author
DesertPixelAi (Account age: 840days)
Extension
ComfyUI-Desert-Pixel-Nodes
Latest Updated
2025-06-22
Github Stars
0.03K

How to Install ComfyUI-Desert-Pixel-Nodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-Desert-Pixel-Nodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-Desert-Pixel-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

DP Extract Mask Description

Extracts masks from images by differentiating RGB and RGBA channels for image processing.

DP Extract Mask:

The DP Extract Mask node is designed to process images by extracting masks based on the image's channel information. Its primary function is to differentiate between RGB and RGBA images, creating a mask that can be used for further image processing tasks. For RGB images, it generates a fully opaque mask, while for RGBA images, it extracts the alpha channel and inverts it to create a mask. This inversion is crucial because the mask format used in ComfyUI considers zero as "keep" and one as "discard." By providing a clear distinction between image types and generating appropriate masks, this node facilitates seamless integration into workflows that require precise image manipulation and compositing.

DP Extract Mask Input Parameters:

image

The image parameter is the primary input for the DP Extract Mask node. It expects an image tensor in the format of (batch, height, width, channels). The function of this parameter is to provide the image data from which the mask will be extracted. The number of channels in the image determines the type of mask that will be generated. For RGB images (3 channels), a fully opaque mask is created, while for RGBA images (4 channels), the alpha channel is extracted and inverted to form the mask. This parameter is crucial as it directly influences the node's output, determining whether an opaque mask or an alpha-based mask is produced. There are no specific minimum, maximum, or default values for this parameter, as it depends on the image data being processed.

DP Extract Mask Output Parameters:

image

The image output parameter provides the processed image data. For RGB images, this output is identical to the input image. For RGBA images, the output is the RGB portion of the image, with the alpha channel removed. This ensures that the image is ready for further processing or compositing without the alpha channel interfering.

mask

The mask output parameter is the result of the mask extraction process. For RGB images, this is a fully opaque mask, meaning all values are zero, indicating that the entire image is kept. For RGBA images, this mask is derived from the inverted alpha channel, where zero values indicate areas to keep and one values indicate areas to discard. This output is essential for tasks that require precise control over which parts of an image are visible or affected by subsequent operations.

DP Extract Mask Usage Tips:

  • Ensure that your input image is in the correct format (batch, height, width, channels) to avoid unexpected results. This node is designed to handle both RGB and RGBA images effectively.
  • Use this node when you need to separate the alpha channel from an RGBA image for compositing tasks. The extracted mask can be used to control visibility or blending in subsequent image processing steps.

DP Extract Mask Common Errors and Solutions:

Unexpected number of channels: <channels>

  • Explanation: This error occurs when the input image has a number of channels other than 3 (RGB) or 4 (RGBA), which the node is not designed to handle.
  • Solution: Verify that your input image is either RGB or RGBA. If your image has a different number of channels, consider converting it to a compatible format before using this node.

DP Extract Mask Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-Desert-Pixel-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 Models, enabling artists to harness the latest AI tools to create incredible art.

DP Extract Mask