ComfyUI > Nodes > ComfyUI_XISER_Nodes > Resize To Divisible

ComfyUI Node: Resize To Divisible

Class Name

XIS_ResizeToDivisible

Category
XISER_Nodes/Image_And_Mask
Author
grinlau18 (Account age: 944days)
Extension
ComfyUI_XISER_Nodes
Latest Updated
2026-03-20
Github Stars
0.03K

How to Install ComfyUI_XISER_Nodes

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

Resize To Divisible Description

Adjusts image dimensions to be divisible by a specified unit, preserving quality and aspect ratio.

Resize To Divisible:

The XIS_ResizeToDivisible node is designed to adjust the dimensions of an image or mask so that they are divisible by a specified unit. This is particularly useful in scenarios where certain processing algorithms or hardware require input dimensions to be aligned to specific sizes for optimal performance or compatibility. By ensuring that the dimensions are divisible by a given number, this node helps maintain the integrity of the image's aspect ratio while making it suitable for further processing. The node supports various resizing modes and interpolation methods, allowing for flexibility in how the resizing is performed. This ensures that the resized image or mask retains as much of its original quality and detail as possible, making it an essential tool for AI artists who need to prepare images for machine learning models or other computational tasks.

Resize To Divisible Input Parameters:

target_width

The target_width parameter specifies the desired width of the output image or mask. It determines how the width of the input will be adjusted to meet the divisibility requirement. The value should be a positive integer, and it directly impacts the final dimensions of the resized output. The minimum value is 1, and there is no explicit maximum, but it should be within the bounds of the original image size.

target_height

The target_height parameter defines the desired height of the output image or mask. Similar to target_width, it ensures that the height is adjusted to be divisible by the specified unit. This parameter is crucial for maintaining the aspect ratio and ensuring that the resized output meets the necessary requirements. The minimum value is 1, and like target_width, it should not exceed the original image size.

min_unit

The min_unit parameter sets the unit by which the dimensions of the image or mask should be divisible. This is a critical parameter as it dictates the granularity of the resizing process. The value should be a positive integer, typically a power of two, to align with common computational requirements. The default value is often set to 8 or 16, depending on the specific needs of the processing pipeline.

resize_mode

The resize_mode parameter determines the method used to resize the image or mask. It can take values such as "force_resize", "scale_proportionally", or "limited_by_canvas", each offering a different approach to resizing. "Force_resize" will adjust the dimensions to exactly match the target width and height, "scale_proportionally" maintains the aspect ratio while resizing, and "limited_by_canvas" ensures the resized image fits within a specified canvas size. The choice of mode affects the final appearance and quality of the resized output.

Resize To Divisible Output Parameters:

image_tensor

The image_tensor output is a tensor representation of the resized image. It is formatted to be compatible with further processing in machine learning models or other computational tasks. The tensor maintains the color channels and spatial dimensions as specified by the input parameters, ensuring that the resized image is ready for immediate use.

mask_tensor

The mask_tensor output is a tensor representation of the resized mask, if applicable. This tensor is crucial for tasks that involve segmentation or other mask-based operations. It retains the spatial dimensions and any relevant mask information, ensuring that the resized mask aligns with the resized image for consistent processing.

Resize To Divisible Usage Tips:

  • Ensure that the min_unit is set to a value that aligns with the requirements of your processing pipeline, such as a power of two, to avoid compatibility issues.
  • When maintaining the aspect ratio is important, use the "scale_proportionally" resize mode to prevent distortion in the resized output.
  • If working with a fixed canvas size, consider using the "limited_by_canvas" mode to ensure that the resized image fits within the desired dimensions without cropping.

Resize To Divisible Common Errors and Solutions:

Invalid target dimensions

  • Explanation: The specified target_width or target_height is not a positive integer or exceeds the original image size.
  • Solution: Ensure that both target_width and target_height are positive integers and do not exceed the dimensions of the original image.

Incompatible min_unit

  • Explanation: The min_unit is not a positive integer or is not suitable for the desired resizing operation.
  • Solution: Set the min_unit to a positive integer, preferably a power of two, to ensure compatibility with common processing requirements.

Unsupported resize_mode

  • Explanation: The specified resize_mode is not recognized or supported by the node.
  • Solution: Use one of the supported resize modes: "force_resize", "scale_proportionally", or "limited_by_canvas".

Resize To Divisible Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_XISER_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.