ComfyUI > Nodes > Comfyui_PDuse > PD:Image Ratio Crop

ComfyUI Node: PD:Image Ratio Crop

Class Name

ImageRatioCrop

Category
PD/ImageProcessing
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 Ratio Crop Description

ImageRatioCrop node automates image cropping to specified aspect ratios and max size constraints.

PD:Image Ratio Crop:

The ImageRatioCrop node is designed to facilitate the precise cropping of images based on specified aspect ratios and maximum size constraints. This node is particularly useful for AI artists who need to ensure their images adhere to specific dimensions or aspect ratios, which is often required for various artistic or commercial purposes. By allowing you to define custom ratios and a maximum size for the longest edge, the node automatically calculates the optimal cropping area to maintain the desired aspect ratio. This ensures that the resulting image is both aesthetically pleasing and meets the necessary specifications. The node's ability to handle these calculations and adjustments automatically simplifies the process of preparing images for further processing or presentation, making it an essential tool for anyone working with digital images.

PD:Image Ratio Crop Input Parameters:

image

The image parameter is the input image that you want to crop. It is expected to be in the form of a tensor, which is a common format for image data in machine learning and image processing tasks. This parameter is crucial as it provides the raw data that the node will process to produce the cropped output.

ratio_a

The ratio_a parameter represents the first part of the aspect ratio you wish to achieve. It is an integer value with a default of 1, and it can range from 1 to 100. This parameter, in conjunction with ratio_b, defines the target aspect ratio for the cropped image. Adjusting this value allows you to control the width aspect of the cropping ratio.

ratio_b

The ratio_b parameter is the second part of the aspect ratio, complementing ratio_a. Like ratio_a, it is an integer with a default value of 1, and it can also range from 1 to 100. This parameter helps define the height aspect of the cropping ratio. Together with ratio_a, it determines the overall shape of the cropped image.

max_size

The max_size parameter specifies the maximum length for the longest edge of the cropped image. It is an integer with a default value of 1024, and it can range from 64 to 8192. This parameter ensures that the resulting image does not exceed a certain size, which is useful for maintaining consistency across a set of images or for meeting specific size requirements.

PD:Image Ratio Crop Output Parameters:

cropped_image

The cropped_image parameter is the output of the node, providing the image that has been cropped according to the specified aspect ratio and maximum size. This output is crucial as it represents the final product of the node's processing, ready for further use or display. The cropped image maintains the desired aspect ratio and size constraints, ensuring it meets the specified requirements.

PD:Image Ratio Crop Usage Tips:

  • To achieve a specific aspect ratio, carefully adjust the ratio_a and ratio_b parameters. For example, for a 16:9 aspect ratio, set ratio_a to 16 and ratio_b to 9. - Use the max_size parameter to control the overall size of the output image, ensuring it fits within your project's requirements without exceeding the maximum allowed dimensions.

PD:Image Ratio Crop Common Errors and Solutions:

Image dimensions exceed maximum resolution

  • Explanation: This error occurs when the input image dimensions exceed the maximum resolution supported by the node.
  • Solution: Ensure that the input image dimensions are within the acceptable range before processing. You may need to resize the image before using the node.

Invalid aspect ratio values

  • Explanation: This error arises when ratio_a or ratio_b is set to a value outside the allowed range.
  • Solution: Verify that both ratio_a and ratio_b are set to values between 1 and 100. Adjust them accordingly to fit within this range.

Maximum size too small

  • Explanation: This error occurs when the max_size parameter is set to a value that is too small to accommodate the desired aspect ratio.
  • Solution: Increase the max_size parameter to ensure it is large enough to fit the desired aspect ratio without compromising the image quality.

PD:Image Ratio Crop 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 Ratio Crop