ComfyUI > Nodes > ComfyUI-InpaintEasy > Image and Mask Resize

ComfyUI Node: Image and Mask Resize

Class Name

ImageAndMaskResizeNode

Category
InpaintEasy
Author
CY-CHENYUE (Account age: 427days)
Extension
ComfyUI-InpaintEasy
Latest Updated
2025-01-24
Github Stars
0.05K

How to Install ComfyUI-InpaintEasy

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

Image and Mask Resize Description

Simultaneously resize images and masks with various methods, including Gaussian blur for smooth transitions.

Image and Mask Resize:

The ImageAndMaskResizeNode is designed to simultaneously resize both images and their corresponding masks, making it an essential tool for tasks that require precise alignment between these two elements, such as inpainting or image editing. This node offers a variety of resizing methods and cropping options, allowing you to tailor the resizing process to your specific needs. Additionally, it includes a feature to apply Gaussian blur to the mask, which can help in smoothing transitions and reducing harsh edges. By providing a comprehensive set of options, this node ensures that you can achieve high-quality results while maintaining the integrity of both the image and the mask.

Image and Mask Resize Input Parameters:

image

This parameter represents the input image that you want to resize. It is crucial as it forms the basis of the resizing operation, ensuring that the final output meets your specified dimensions and quality requirements.

mask

The mask parameter is the corresponding mask for the input image, which will be resized alongside the image. This ensures that the mask remains aligned with the image, preserving the intended areas of focus or exclusion.

width

This integer parameter specifies the desired width of the resized image and mask. It ranges from a minimum of 64 to a maximum of 8192, with a default value of 512. Adjusting this parameter allows you to control the horizontal dimension of the output.

height

Similar to the width parameter, this integer defines the desired height of the resized image and mask. It also ranges from 64 to 8192, with a default of 512. This parameter lets you set the vertical dimension of the output.

resize_method

This parameter determines the method used for resizing the image and mask. Options include "nearest-exact", "bilinear", "area", "bicubic", and "lanczos", with "lanczos" as the default. Each method offers different trade-offs between speed and quality, allowing you to choose the most suitable one for your task.

crop

The crop parameter specifies how the image and mask should be cropped after resizing. Options include "disabled", "center", "top_left", "top_right", "bottom_left", and "bottom_right", with "disabled" as the default. This allows you to focus on specific areas of the image if needed.

mask_blur_radius

This integer parameter sets the radius for applying Gaussian blur to the mask, ranging from 0 to 64, with a default of 10. A higher value results in a smoother mask, which can help in blending the mask with the image more naturally.

Image and Mask Resize Output Parameters:

image

The output image is the resized version of the input image, adjusted according to the specified width, height, and resize method. This output is crucial for ensuring that the image fits the desired dimensions while maintaining quality.

mask

The output mask is the resized version of the input mask, aligned with the resized image. This ensures that the mask accurately corresponds to the image, preserving the intended areas of focus or exclusion.

Image and Mask Resize Usage Tips:

  • To achieve the best quality when resizing, experiment with different resize_method options to find the one that best suits your image type and desired output.
  • Use the mask_blur_radius to smooth out the edges of the mask, especially when working with complex or detailed images, to ensure a more natural blend.

Image and Mask Resize Common Errors and Solutions:

"Invalid dimensions: width and height must be greater than zero"

  • Explanation: This error occurs when both the width and height parameters are set to zero, which is not allowed.
  • Solution: Ensure that at least one of the dimensions (width or height) is set to a value greater than zero.

"Unsupported resize method"

  • Explanation: This error indicates that the specified resize method is not recognized by the node.
  • Solution: Double-check the resize_method parameter to ensure it matches one of the supported options: "nearest-exact", "bilinear", "area", "bicubic", or "lanczos".

Image and Mask Resize Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-InpaintEasy
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. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.