ComfyUI Extension: ComfyUI-ImageAutosize
A node for ComfyUI that provides a convenient way of resizing or cropping an image for diffusion tasks.
Custom Nodes (0)
README
ComfyUI-ImageAutosize
A node for ComfyUI that provides a convenient way of resizing or cropping an image for diffusion tasks.
This node was designed with the goal of being easy to "set and forget," allowing you to pre-process any input image without having to frequently adjust your parameters.

Installation
Simply drag the image above into ComfyUI and use ComfyUI Manager » Install Missing Custom Nodes.
Inputs
image: The image to modify.max_size(int): The node will resize the larger dimension of theimageto this size in pixels, preserving aspect ratio.min_size(int): After evaluatingmax_size, the node will check the smaller dimension of theimage. If it's less thanmin_size, the smaller dimension will be upscaled to this value, preserving aspect ratio.divisible_by(int): After evaluating bothmax_sizeandmin_size, the dimensions of the image will be rounded to values that are multiples ofdivisible_by. This is useful for diffusion models, which often expect sizes that are divisible by 64.interpolation_mode(string): Name of the resizing method.crop_mode(string): Cropping is often needed to satisfydivisble_by, and this input lets you choose the origin of the crop. Set it tononeto disable cropping altogether.
Outputs
image(image): The modified image.width(int): The resulting image width in pixels.height(int): The resulting image height in pixels.multiplier(float): The multiplier applied to the original image's dimensions. Useful if you want to resize another image or mask by the same amount.
This node was adapted from the [img2img_autosize] shortcode of Unprompted, my Automatic1111 extension.