Visit ComfyUI Online for ready-to-use ComfyUI environment
Scale image and mask to match reference image dimensions with various resampling methods for precise alignment and consistency.
The LayerUtility: ImageMaskScaleAs node is designed to scale an image and its corresponding mask to match the dimensions of a reference image. This node is particularly useful when you need to ensure that your image and mask are resized consistently to fit a specific target size, maintaining the aspect ratio and alignment. It offers various resampling methods to achieve the desired quality and precision in the scaling process. By using this node, you can streamline your workflow, ensuring that your images and masks are perfectly aligned and scaled, which is essential for tasks that require precise image manipulation and consistency.
This parameter specifies the reference image whose dimensions will be used as the target size for scaling the input image and mask. The node will extract the width and height from this reference image to determine the target dimensions for the scaling process.
This parameter determines how the input image and mask will be resized to fit the target dimensions. It controls whether the image should be scaled to fit within the target dimensions while maintaining its aspect ratio or if it should be stretched to fill the target dimensions completely.
This parameter specifies the resampling method to be used for scaling the image and mask. The available options include "LANCZOS", "bicubic", "hamming", "bilinear", "box", and "nearest". Each method offers different levels of quality and performance, with "LANCZOS" providing high-quality results and "nearest" being the fastest but with lower quality.
This optional parameter allows you to input the image that needs to be scaled. If provided, the node will resize this image to match the dimensions of the reference image specified by the scale_as
parameter.
This optional parameter allows you to input the mask that needs to be scaled. If provided, the node will resize this mask to match the dimensions of the reference image specified by the scale_as
parameter.
This output parameter returns the scaled image, resized to match the dimensions of the reference image. If no image was provided as input, this parameter will be None
.
This output parameter returns the scaled mask, resized to match the dimensions of the reference image. If no mask was provided as input, this parameter will be None
.
This output parameter returns a list containing the original width and height of the input image or mask before scaling. This information is useful for reference and comparison purposes.
This output parameter returns the target width extracted from the reference image specified by the scale_as
parameter. It indicates the width to which the input image and mask were scaled.
This output parameter returns the target height extracted from the reference image specified by the scale_as
parameter. It indicates the height to which the input image and mask were scaled.
scale_as
parameter is set to a valid reference image to achieve the desired target dimensions for scaling.fit
parameter to control whether the input image and mask should maintain their aspect ratio or be stretched to fill the target dimensions.image
or mask
parameters is provided with valid input data.© Copyright 2024 RunComfy. All Rights Reserved.