Visit ComfyUI Online for ready-to-use ComfyUI environment
Crop and resize images to specific aspect ratios with automatic dimension calculation and high-quality interpolation options.
The ImageCropByRatioAndResize
node is designed to help you crop an image to a specific aspect ratio and then resize it to desired dimensions. This node is particularly useful when you need to ensure that your images fit a particular size or aspect ratio, which is often required for various artistic and design purposes. By automatically calculating the necessary crop dimensions based on the provided width and height ratios, this node simplifies the process of preparing images for different formats and resolutions. Additionally, it offers various interpolation methods to ensure the resized image maintains high quality.
This parameter takes the input image that you want to crop and resize. The image should be in a format that the node can process, typically a tensor or array representing the image data.
This parameter specifies the target width ratio for cropping the image. It determines the width of the cropped area relative to the height. The value should be a positive integer.
This parameter specifies the target height ratio for cropping the image. It determines the height of the cropped area relative to the width. The value should be a positive integer.
This parameter allows you to specify the position of the crop. Options include "top", "bottom", "left", "right", and "center". This helps you control which part of the image is retained after cropping.
This parameter determines the method used for resizing the image after cropping. Options include "nearest-exact", "bilinear", "area", "bicubic", and "lanczos". Each method offers different trade-offs between speed and quality.
The output image is the cropped and resized version of the input image. It retains the specified aspect ratio and dimensions, making it suitable for your intended use.
This output parameter provides the width of the resized image. It helps you verify that the image has been resized to the correct dimensions.
This output parameter provides the height of the resized image. It helps you verify that the image has been resized to the correct dimensions.
© Copyright 2024 RunComfy. All Rights Reserved.