ComfyUI  >  Nodes  >  KJNodes for ComfyUI >  Resize Image

ComfyUI Node: Resize Image

Class Name

ImageResizeKJ

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

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

Resize Image Description

Resize images with aspect ratio control and upscale options for AI artists' specific size requirements.

Resize Image:

The ImageResizeKJ node is designed to resize images to specified dimensions while offering flexibility in maintaining aspect ratios and choosing upscale methods. This node is particularly useful for AI artists who need to prepare images for various applications, ensuring that the images meet specific size requirements without distorting their proportions. By leveraging different upscale methods, the node provides high-quality resizing options that can cater to different artistic needs, whether it's for creating thumbnails, preparing images for further processing, or simply adjusting the size for better visualization.

Resize Image Input Parameters:

image

This parameter accepts the image that you want to resize. The image should be in a format compatible with the node's processing capabilities.

width

This parameter specifies the target width for the resized image. If set to 0, the original width of the image is maintained. The default value is 512, with a minimum of 0 and a maximum defined by the system's maximum resolution.

height

This parameter specifies the target height for the resized image. If set to 0, the original height of the image is maintained. The default value is 512, with a minimum of 0 and a maximum defined by the system's maximum resolution.

upscale_method

This parameter allows you to choose the method used for resizing the image. Options include "nearest-exact", "bilinear", "area", "bicubic", and "lanczos". Each method offers different qualities of resizing, with "nearest-exact" being the simplest and "lanczos" providing the highest quality.

keep_proportion

This boolean parameter determines whether the aspect ratio of the image should be maintained during resizing. If set to True, the image will be resized proportionally based on the highest dimension. The default value is False.

divisible_by

This parameter ensures that the final dimensions of the resized image are divisible by the specified value. This can be useful for certain applications that require image dimensions to be multiples of a specific number. The default value is 2, with a minimum of 0 and a maximum of 512.

width_input

This optional parameter allows you to input a specific width for the resized image, overriding the width parameter if provided.

height_input

This optional parameter allows you to input a specific height for the resized image, overriding the height parameter if provided.

get_image_size

This optional parameter can be used to retrieve the size of the image from another source, which will then be used to determine the final dimensions of the resized image.

Resize Image Output Parameters:

IMAGE

The resized image, adjusted according to the specified width, height, and other parameters. This output is ready for further processing or use in your projects.

width

The final width of the resized image. This value reflects any adjustments made to maintain aspect ratio or meet the divisibility requirement.

height

The final height of the resized image. This value reflects any adjustments made to maintain aspect ratio or meet the divisibility requirement.

Resize Image Usage Tips:

  • To maintain the aspect ratio of your image, set the keep_proportion parameter to True. This ensures that the image does not get distorted during resizing.
  • Experiment with different upscale_method options to find the best quality for your specific use case. For example, "lanczos" often provides the best quality for artistic images.
  • Use the divisible_by parameter to ensure that your image dimensions are compatible with other tools or processes that require specific dimension multiples.

Resize Image Common Errors and Solutions:

"Invalid image format"

  • Explanation: The input image is in a format that is not supported by the node.
  • Solution: Convert the image to a supported format such as JPEG or PNG before using the node.

"Width and height cannot both be zero"

  • Explanation: Both the width and height parameters are set to 0, which is not allowed.
  • Solution: Ensure that at least one of the dimensions (width or height) is set to a non-zero value.

"Invalid upscale method"

  • Explanation: The specified upscale method is not recognized.
  • Solution: Choose an upscale method from the available options: "nearest-exact", "bilinear", "area", "bicubic", or "lanczos".

"Image dimensions not divisible by specified value"

  • Explanation: The final dimensions of the image are not divisible by the value specified in the divisible_by parameter.
  • Solution: Adjust the divisible_by parameter to a value that allows the final dimensions to be divisible, or modify the target width and height accordingly.

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.