ComfyUI  >  Nodes  >  ComfyUI Layer Style >  LayerUtility: ImageMaskScaleAs

ComfyUI Node: LayerUtility: ImageMaskScaleAs

Class Name

LayerUtility: ImageMaskScaleAs

Category
😺dzNodes/LayerUtility
Author
chflame163 (Account age: 445 days)
Extension
ComfyUI Layer Style
Latest Updated
6/24/2024
Github Stars
0.6K

How to Install ComfyUI Layer Style

Install this extension via the ComfyUI Manager by searching for  ComfyUI Layer Style
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI Layer Style 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
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

LayerUtility: ImageMaskScaleAs Description

Scale image and mask to match reference image dimensions with various resampling methods for precise alignment and consistency.

LayerUtility: ImageMaskScaleAs:

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.

LayerUtility: ImageMaskScaleAs Input Parameters:

scale_as

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.

fit

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.

method

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.

image

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.

mask

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.

LayerUtility: ImageMaskScaleAs Output Parameters:

scaled_image

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.

scaled_mask

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.

original_dimensions

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.

target_width

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.

target_height

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.

LayerUtility: ImageMaskScaleAs Usage Tips:

  • Ensure that the scale_as parameter is set to a valid reference image to achieve the desired target dimensions for scaling.
  • Choose the appropriate resampling method based on the quality and performance requirements of your task. For high-quality results, use "LANCZOS" or "bicubic".
  • Use the fit parameter to control whether the input image and mask should maintain their aspect ratio or be stretched to fill the target dimensions.

LayerUtility: ImageMaskScaleAs Common Errors and Solutions:

Error: LayerUtility: ImageMaskScaleAs skipped, because the available image or mask is not found.

  • Explanation: This error occurs when neither an image nor a mask is provided as input to the node.
  • Solution: Ensure that at least one of the image or mask parameters is provided with valid input data.

Error: LayerUtility: ImageMaskScaleAs skipped, because the mask doesn't match the image.

  • Explanation: This error occurs when the dimensions of the provided mask do not match the dimensions of the provided image.
  • Solution: Ensure that the input image and mask have matching dimensions before processing them with the node.

LayerUtility: ImageMaskScaleAs Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI Layer Style
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.