ComfyUI > Nodes > comfyui-fitsize > Fit Size From Int (FS)

ComfyUI Node: Fit Size From Int (FS)

Class Name

FS: Fit Size From Int

Category
Fitsize/Numbers
Author
bronkula (Account age: 5210days)
Extension
comfyui-fitsize
Latest Updated
2024-05-22
Github Stars
0.04K

How to Install comfyui-fitsize

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

Fit Size From Int (FS) Description

Resize images while maintaining aspect ratio to fit within specified size constraints.

Fit Size From Int (FS):

The FS: Fit Size From Int node is designed to help you resize images while maintaining their aspect ratio. This node is particularly useful when you need to ensure that an image fits within a specified maximum size, either by scaling it down or up. The primary goal of this node is to calculate the optimal width and height for an image so that it fits within the given constraints without distorting its original proportions. This is especially beneficial for AI artists who need to prepare images for various applications, ensuring that the images are appropriately sized for their intended use.

Fit Size From Int (FS) Input Parameters:

original_width

This parameter represents the original width of the image in pixels. It is an integer value that specifies the starting width before any resizing is applied. The function of this parameter is to provide the node with the initial width of the image so that it can calculate the new dimensions based on the maximum size constraint. There are no minimum or maximum values specified for this parameter, but it should be a positive integer.

original_height

This parameter represents the original height of the image in pixels. Similar to the original_width, it is an integer value that specifies the starting height before any resizing is applied. The function of this parameter is to provide the node with the initial height of the image so that it can calculate the new dimensions based on the maximum size constraint. There are no minimum or maximum values specified for this parameter, but it should be a positive integer.

max_size

This parameter sets the maximum size (in pixels) that either the width or height of the image can be after resizing. It is an integer value with a default of 768 pixels and increments in steps of 8 pixels. The function of this parameter is to define the upper limit for the resized image dimensions, ensuring that the image does not exceed this size while maintaining its aspect ratio. This parameter helps in controlling the final size of the image to fit specific requirements.

upscale

This parameter is a boolean option that determines whether the image should be upscaled if its original dimensions are smaller than the specified max_size. The available options are "false" and "true". When set to "false", the image will only be scaled down if it exceeds the max_size, but will not be upscaled. When set to "true", the image can be both scaled down and up to fit within the max_size constraint. This parameter is useful for ensuring that smaller images can be enlarged to meet the size requirements.

Fit Size From Int (FS) Output Parameters:

Fit Width

This output parameter represents the new width of the image after resizing. It is an integer value that indicates the optimal width calculated based on the original dimensions and the max_size constraint. The Fit Width ensures that the image fits within the specified maximum size while maintaining its aspect ratio.

Fit Height

This output parameter represents the new height of the image after resizing. It is an integer value that indicates the optimal height calculated based on the original dimensions and the max_size constraint. The Fit Height ensures that the image fits within the specified maximum size while maintaining its aspect ratio.

Aspect Ratio

This output parameter represents the aspect ratio of the image after resizing. It is a float value that indicates the ratio of the width to the height of the image. The Aspect Ratio helps in understanding the proportional relationship between the width and height of the resized image, ensuring that the image's original proportions are preserved.

Fit Size From Int (FS) Usage Tips:

  • To ensure that your images fit within a specific size constraint without distortion, set the max_size parameter to the desired maximum dimension.
  • If you want to maintain the original size of smaller images and only scale down larger images, set the upscale parameter to "false".
  • For applications where both scaling up and down are acceptable, set the upscale parameter to "true" to allow the node to resize images in both directions.

Fit Size From Int (FS) Common Errors and Solutions:

Invalid input type for original_width or original_height

  • Explanation: This error occurs when the original_width or original_height parameters are not provided as integer values.
  • Solution: Ensure that both original_width and original_height are specified as positive integers.

max_size must be a positive integer

  • Explanation: This error occurs when the max_size parameter is not provided as a positive integer.
  • Solution: Ensure that the max_size parameter is set to a positive integer value, with a default of 768 and increments in steps of 8.

Invalid option for upscale parameter

  • Explanation: This error occurs when the upscale parameter is not set to either "false" or "true".
  • Solution: Ensure that the upscale parameter is set to one of the valid options: "false" or "true".

Fit Size From Int (FS) Related Nodes

Go back to the extension to check out more related nodes.
comfyui-fitsize
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.