A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.
The LayerUtility: ImageScaleByAspectRatio V2
node is a powerful image processing tool within the ComfyUI framework. It enables users to scale images while preserving or altering their aspect ratios. This node provides flexibility in resizing images according to various user-defined criteria, utilizing several fitting modes and rendering methods to achieve the desired output.
This node is designed to adjust the dimensions of images based on a specified aspect ratio. It can either maintain the original aspect ratio or use a custom one, ensuring that the resulting image’s width and height fit particular constraints. This is especially useful in workflows where images need to be standardized in size while preserving certain visual characteristics.
This node accepts the following inputs:
Aspect Ratio: Defines how the image's dimensions are proportioned. Options include:
original
: Maintains the original aspect ratio of the image.custom
: Allows for a user-defined aspect ratio.1:1
, 3:2
, 4:3
, 16:9
, 2:3
, 3:4
, 9:16
.Proportional Width & Proportional Height: Integers that define the custom width and height ratios when custom
is selected as the aspect ratio.
Fit Mode: Specifies how the image will be adjusted within the new dimensions. Options include letterbox
, crop
, and fill
.
Method Mode: Selects the algorithm for image resampling during resizing. Available methods are lanczos
, bicubic
, hamming
, bilinear
, box
, and nearest
.
Round to Multiple: Ensures that the final image dimensions are rounded up to a specified multiple. Options range from 8
to 512
, or None
.
Scale To Side: Determines which side of the image is used for scaling. Options include None
, longest
, shortest
, width
, height
, and total_pixel(kilo pixel)
.
Scale To Length: An integer specifying the target length for scaling, applicable when Scale To Side
is not None
.
Background Color: A string value defining the background color used when resizing with letterbox
fit mode.
The node produces the following outputs:
Within a ComfyUI workflow, this node can be employed to standardize image sizes, adapt images for display on various devices, or prepare images for further processing steps. The flexibility in aspect ratio selection and the variety of fit and method modes make it a versatile node suitable for numerous scenarios. Users can efficiently incorporate this node to ensure consistent image dimensions across different workflow stages, especially in graphics design or digital content creation pipelines.
Consider the implications of aspect ratio changes and rounding to multiples on the image's visual appearance, as they can impact the final result significantly, especially in design-sensitive workflows.