ComfyUI > Nodes > KJNodes for ComfyUI > Load & Resize Image

ComfyUI Node: Load & Resize Image

Class Name

LoadAndResizeImage

Category
KJNodes/image
Author
kijai (Account age: 2192days)
Extension
KJNodes for ComfyUI
Latest Updated
2024-06-25
Github Stars
0.35K

How to Install KJNodes for ComfyUI

Install this extension via the ComfyUI Manager by searching for KJNodes for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter KJNodes for ComfyUI 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

Load & Resize Image Description

Streamline image loading and resizing for AI artists, preserving quality and saving time.

Load & Resize Image:

The LoadAndResizeImage node is designed to streamline the process of loading and resizing images, making it an essential tool for AI artists who need to prepare images for various applications. This node allows you to load an image from a specified path and resize it according to your requirements, either by maintaining the original aspect ratio or by adjusting to specific dimensions. The node also supports downscaling and upscaling methods, ensuring that the image quality is preserved as much as possible. By automating these tasks, LoadAndResizeImage helps you save time and effort, allowing you to focus more on the creative aspects of your work.

Load & Resize Image Input Parameters:

image

This parameter specifies the path to the image file you want to load. The image should be in a supported format, excluding formats like MPO. The node will read the image from this path and prepare it for resizing.

resize

A boolean parameter that determines whether the image should be resized. If set to True, the image will be resized according to the specified width and height. If False, the image will retain its original dimensions. Default is False.

width

This parameter sets the target width for the image. If keep_proportion is enabled and only the height is specified, the width will be calculated to maintain the aspect ratio. If set to 0, the original width of the image will be used. Default is 0.

height

This parameter sets the target height for the image. Similar to the width parameter, if keep_proportion is enabled and only the width is specified, the height will be calculated to maintain the aspect ratio. If set to 0, the original height of the image will be used. Default is 0.

repeat

A boolean parameter that determines whether the image should be repeated. This is useful for creating patterns or textures. Default is False.

keep_proportion

A boolean parameter that ensures the aspect ratio of the image is maintained during resizing. If enabled, the node will calculate the appropriate width or height to preserve the original proportions of the image. Default is True.

divisible_by

This parameter ensures that the final dimensions of the image are divisible by the specified value. This is particularly useful for certain applications that require image dimensions to be multiples of a specific number. Default is 1.

mask_channel

This parameter specifies the channel to be used for the mask, if any. It allows you to apply a mask to the image during the resizing process, which can be useful for various image processing tasks.

Load & Resize Image Output Parameters:

image

The resized image, returned as a tensor. This output can be used in subsequent nodes for further processing or analysis.

width

The width of the resized image. This value is useful for verifying that the image has been resized correctly and for any further processing that requires knowledge of the image dimensions.

height

The height of the resized image. Similar to the width, this value is important for ensuring the image has been resized as expected and for any additional processing steps.

Load & Resize Image Usage Tips:

  • To maintain the aspect ratio of your image while resizing, make sure to enable the keep_proportion parameter.
  • Use the divisible_by parameter to ensure your image dimensions are compatible with specific requirements, such as those needed for certain neural network architectures.
  • If you need to create a pattern or texture, enable the repeat parameter to repeat the image.

Load & Resize Image Common Errors and Solutions:

"File not found"

  • Explanation: The specified image path does not exist or is incorrect.
  • Solution: Verify that the image path is correct and that the file exists at the specified location.

"Unsupported image format"

  • Explanation: The image format is not supported by the node.
  • Solution: Convert the image to a supported format such as JPEG or PNG and try again.

"Invalid dimensions"

  • Explanation: The specified width or height is invalid, possibly due to being set to zero while keep_proportion is disabled.
  • Solution: Ensure that the width and height are set to valid values, or enable keep_proportion to allow the node to calculate the appropriate dimensions.

"Mask channel not found"

  • Explanation: The specified mask channel does not exist in the image.
  • Solution: Verify that the image contains the specified mask channel and that the channel index is correct.

Load & Resize Image Related Nodes

Go back to the extension to check out more related nodes.
KJNodes for ComfyUI
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.