ComfyUI > Nodes > ComfyUI Layer Style > LayerUtility: ImageScaleRestore V2

ComfyUI Node: LayerUtility: ImageScaleRestore V2

Class Name

LayerUtility: ImageScaleRestore V2

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

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: ImageScaleRestore V2 Description

Resize and restore images while maintaining quality and integrity, with support for multiple interpolation methods.

LayerUtility: ImageScaleRestore V2:

LayerUtility: ImageScaleRestore V2 is a powerful node designed to help you resize and restore images to a desired scale or dimension while maintaining the quality and integrity of the original image. This node is particularly useful for AI artists who need to upscale or downscale images for various applications, such as preparing images for training models, creating consistent image sizes for a project, or restoring images to their original dimensions after processing. The node supports multiple interpolation methods, ensuring that you can choose the best method for your specific needs. By leveraging this node, you can achieve high-quality image resizing with minimal loss of detail, making it an essential tool in your image processing workflow.

LayerUtility: ImageScaleRestore V2 Input Parameters:

image

This parameter represents the input image or a batch of images that you want to resize. The images should be provided in a tensor format, which is commonly used in deep learning frameworks. The quality and resolution of the input image will directly impact the results of the resizing process.

scale

This parameter defines the scaling factor by which the input image will be resized. A value greater than 1 will upscale the image, while a value less than 1 will downscale it. The default value is typically 1, meaning no scaling. Adjusting this parameter allows you to control the size of the output image relative to the original.

method

This parameter specifies the interpolation method used for resizing the image. Available options include "bicubic," "hamming," "bilinear," "box," and "nearest." Each method has its own characteristics and is suitable for different types of images and desired outcomes. For example, "bicubic" is often used for high-quality resizing, while "nearest" is faster but may produce blocky results.

scale_by

This parameter determines whether the scaling should be based on the longest side of the image or another criterion. It allows for more flexible resizing options, ensuring that the aspect ratio of the image is maintained or adjusted according to your needs.

scale_by_length

This parameter sets the target length for the longest side of the image when scale_by is enabled. It ensures that the resized image fits within the specified dimensions, making it useful for standardizing image sizes across a dataset or project.

mask

This optional parameter allows you to provide a mask image that will be resized along with the input image. The mask can be used to preserve certain areas of the image during processing, ensuring that important details are not lost. If no mask is provided, a default white mask will be used.

original_size

This optional parameter specifies the original dimensions of the image. If provided, the node will restore the image to these dimensions instead of using the scaling factor. This is useful for reverting images to their original size after processing or transformations.

LayerUtility: ImageScaleRestore V2 Output Parameters:

resized_images

This output parameter contains the resized images in tensor format. The images will be scaled according to the specified parameters, ensuring high-quality results that maintain the integrity of the original images.

resized_masks

This output parameter contains the resized masks in tensor format, if a mask was provided. The masks will be scaled along with the images, ensuring that any important areas defined by the masks are preserved during the resizing process.

original_dimensions

This output parameter provides the original width and height of the input images. It is useful for reference and for any further processing that may require knowledge of the original image dimensions.

target_width

This output parameter indicates the width of the resized images. It is determined based on the scaling factor or the specified target dimensions, ensuring that the output images meet your requirements.

target_height

This output parameter indicates the height of the resized images. Similar to target_width, it is determined based on the scaling factor or the specified target dimensions.

LayerUtility: ImageScaleRestore V2 Usage Tips:

  • When resizing images for training machine learning models, use the "bicubic" method for high-quality results that preserve image details.
  • If you need to standardize the size of a batch of images, use the scale_by and scale_by_length parameters to ensure consistent dimensions across all images.
  • Provide a mask if you need to preserve specific areas of the image during resizing, such as important features or regions of interest.

LayerUtility: ImageScaleRestore V2 Common Errors and Solutions:

"Invalid image format"

  • Explanation: The input image is not in the expected tensor format.
  • Solution: Ensure that the input image is provided as a tensor. Convert the image to the correct format if necessary.

"Unsupported interpolation method"

  • Explanation: The specified interpolation method is not recognized.
  • Solution: Check the method parameter and ensure it is set to one of the supported methods: "bicubic," "hamming," "bilinear," "box," or "nearest."

"Target dimensions too small"

  • Explanation: The calculated target width or height is less than the minimum allowed size.
  • Solution: Adjust the scaling factor or target dimensions to ensure that the width and height are at least 4 pixels.

LayerUtility: ImageScaleRestore V2 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.