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 Resize Image And Mask

ComfyUI Node: DP Resize Image And Mask

Class Name

DP Resize Image And 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 Resize Image And Mask Description

Resizes images and masks while maintaining proportions, offering flexible resizing options.

DP Resize Image And Mask:

The DP Resize Image And Mask node is designed to facilitate the resizing of images and their corresponding masks, ensuring that both elements maintain their relative proportions and alignment. This node is particularly beneficial for AI artists who need to adjust image dimensions while preserving the integrity of associated masks, which are often used for tasks like segmentation or inpainting. By offering options to maintain aspect ratios and apply various resizing methods, this node provides flexibility and precision in image processing workflows. It also includes features to handle masks that do not initially match the image dimensions, ensuring a seamless resizing process. Additionally, the node can export images with an alpha channel or force RGB output, making it versatile for different artistic and technical requirements.

DP Resize Image And Mask Input Parameters:

image

The image parameter represents the input image tensor that you wish to resize. It is crucial as it forms the basis of the resizing operation. The image should be in a tensor format with dimensions typically structured as (batch, height, width, channels).

width

The width parameter specifies the target width for the resized image. If set to zero, the width will be automatically calculated based on the height and the original aspect ratio, provided keep_proportions is enabled. The minimum value is 64 pixels to ensure a reasonable resolution.

height

The height parameter defines the target height for the resized image. Similar to the width, if set to zero, it will be calculated based on the width and the original aspect ratio if keep_proportions is enabled. The minimum value is 64 pixels.

keep_proportions

The keep_proportions parameter is a boolean that determines whether the original aspect ratio of the image should be maintained during resizing. If true, the node will adjust either the width or height to preserve the aspect ratio, depending on which dimension is specified.

upscale_method

The upscale_method parameter allows you to choose the method used for resizing the image and mask. This can affect the quality and speed of the resizing process, with options typically including methods like nearest-neighbor, bilinear, or bicubic interpolation.

crop

The crop parameter specifies whether the image should be cropped during the resizing process. This can be useful if you want to focus on a specific area of the image while resizing.

export_image_with_alpha

The export_image_with_alpha parameter is a boolean that, when enabled, exports the resized image with an alpha channel if a mask is provided. This is useful for creating images with transparency.

force_rgb_output

The force_rgb_output parameter is a boolean that, when enabled, ensures the output image is in RGB format by discarding any alpha channel. This is particularly useful for compatibility with systems or nodes that require RGB images.

mask_opt

The mask_opt parameter is an optional input that represents the mask associated with the image. If provided, the mask will be resized alongside the image to ensure alignment. If not provided, a default empty mask will be created.

DP Resize Image And Mask Output Parameters:

image_resized

The image_resized output is the resized version of the input image, adjusted according to the specified width, height, and other parameters. This output is crucial for further processing or analysis in workflows that require specific image dimensions.

mask_resized

The mask_resized output is the resized version of the input mask, ensuring it matches the dimensions of the resized image. This is essential for maintaining the integrity of mask-based operations, such as segmentation or inpainting.

DP Resize Image And Mask Usage Tips:

  • To maintain the original aspect ratio of your image, enable the keep_proportions parameter. This ensures that the image does not appear stretched or compressed after resizing.
  • If you need to work with transparent images, consider enabling the export_image_with_alpha parameter to retain the alpha channel in the output.
  • Use the force_rgb_output parameter when you need to ensure compatibility with systems that only accept RGB images, as this will remove any alpha channel from the output.

DP Resize Image And Mask Common Errors and Solutions:

Warning: Mask dimensions don't match image dimensions

  • Explanation: This warning occurs when the dimensions of the provided mask do not match those of the original image, which can lead to misalignment during processing.
  • Solution: Ensure that the mask dimensions match the original image dimensions before inputting them into the node. The node will attempt to resize the mask to match the image, but providing correctly sized inputs initially can prevent this warning.

Image or mask dimensions are below minimum threshold

  • Explanation: This error occurs when the specified width or height is below the minimum allowed value of 64 pixels.
  • Solution: Adjust the width and height parameters to be at least 64 pixels to ensure proper resizing and avoid this error.

DP Resize Image And 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 Resize Image And Mask