ComfyUI > Nodes > Comfyui_PDuse > PD:image_resize_v1

ComfyUI Node: PD:image_resize_v1

Class Name

PDImageResize

Category
image
Author
7BEII (Account age: 453days)
Extension
Comfyui_PDuse
Latest Updated
2026-03-25
Github Stars
0.05K

How to Install Comfyui_PDuse

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

PD:image_resize_v1 Description

Efficiently resizes images while maintaining aspect ratio, with options for edge-based resizing and mask handling.

PD:image_resize_v1:

The PDImageResize node is designed to efficiently resize images while maintaining their aspect ratio, making it an essential tool for AI artists who need to adjust image dimensions without distorting the content. This node offers flexibility by allowing you to choose between resizing based on the shortest or longest edge of the image, ensuring that the resized image fits your specific requirements. Additionally, it can handle optional masks, resizing them alongside the image to maintain consistency in applications where masks are used for further image processing or effects. By leveraging advanced interpolation techniques, the node ensures high-quality results, making it a valuable asset for any image processing workflow.

PD:image_resize_v1 Input Parameters:

resize_mode

The resize_mode parameter determines how the image will be resized. It accepts two options: "shortest" and "longest". When set to "shortest", the image is resized such that its shortest edge matches the target size, preserving the aspect ratio. Conversely, when set to "longest", the longest edge is adjusted to the target size. This parameter is crucial for controlling the resizing behavior and ensuring that the image dimensions meet your specific needs.

target_size

The target_size parameter specifies the desired size for the edge determined by the resize_mode. It is a numerical value that represents the length in pixels. This parameter directly impacts the final dimensions of the resized image, making it essential for achieving the desired output size.

mask_optional

The mask_optional parameter is an optional input that allows you to provide a mask tensor with the shape (B, H, W). If provided, the mask will be resized alongside the image, ensuring that any masking effects remain aligned with the resized image. If no mask is provided, a default mask of zeros will be generated. This parameter is particularly useful when working with images that require additional processing based on specific regions.

PD:image_resize_v1 Output Parameters:

pixels

The pixels output is the resized image tensor. It reflects the new dimensions as determined by the resize_mode and target_size parameters. This output is crucial for further processing or use in applications where specific image dimensions are required.

mask

The mask output is the resized mask tensor. If a mask was provided as input, this output will be the resized version of that mask. If no mask was provided, it will be a default mask of zeros. This output is important for maintaining consistency in workflows that involve masked image processing.

PD:image_resize_v1 Usage Tips:

  • To maintain the aspect ratio while resizing, choose the resize_mode that best fits your needs: "shortest" for adjusting the shortest edge or "longest" for the longest edge.
  • When working with images that require masks, always provide the mask_optional parameter to ensure that the mask is resized consistently with the image.
  • Use the target_size parameter to precisely control the dimensions of the resized image, ensuring it fits your specific requirements.

PD:image_resize_v1 Common Errors and Solutions:

Invalid resize_mode

  • Explanation: The resize_mode parameter must be either "shortest" or "longest". Any other value will result in an error.
  • Solution: Ensure that the resize_mode is set to either "shortest" or "longest" before executing the node.

Invalid target_size

  • Explanation: The target_size must be a positive numerical value. Negative or zero values are not valid.
  • Solution: Verify that the target_size is a positive number and adjust it accordingly.

Mask shape mismatch

  • Explanation: The provided mask does not match the expected shape (B, H, W).
  • Solution: Ensure that the mask tensor has the correct shape before providing it as input to the node.

PD:image_resize_v1 Related Nodes

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

PD:image_resize_v1