ComfyUI  >  Nodes  >  WAS Node Suite >  Image Aspect Ratio

ComfyUI Node: Image Aspect Ratio

Class Name

Image Aspect Ratio

Category
WAS Suite/Logic
Author
WASasquatch (Account age: 4688 days)
Extension
WAS Node Suite
Latest Updated
8/25/2024
Github Stars
1.1K

How to Install WAS Node Suite

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

Image Aspect Ratio Description

Calculates image aspect ratio for AI artists, determining landscape, portrait, or square format, aiding image processing decisions.

Image Aspect Ratio:

The Image Aspect Ratio node is designed to calculate and provide detailed information about the aspect ratio of an image. This node is particularly useful for AI artists who need to understand the dimensions and orientation of their images, whether they are working with specific width and height values or an image tensor. By determining the aspect ratio, this node helps you identify whether an image is in landscape, portrait, or square format, which can be crucial for various artistic and technical applications. Additionally, it provides a common aspect ratio representation and a boolean value indicating if the image is in landscape mode, making it easier to make informed decisions about image processing and composition.

Image Aspect Ratio Input Parameters:

image

This optional parameter accepts an image tensor. If provided, the node will use the dimensions of this image to calculate the aspect ratio. This is useful when you have an image tensor and want to quickly determine its aspect ratio without manually inputting width and height values.

width

This optional parameter accepts a numerical value representing the width of the image. If both width and height are provided, the node will use these values to calculate the aspect ratio. This parameter is useful when you know the exact dimensions of your image and prefer to input them directly.

height

This optional parameter accepts a numerical value representing the height of the image. Similar to the width parameter, if both height and width are provided, the node will use these values to calculate the aspect ratio. This parameter is useful when you know the exact dimensions of your image and prefer to input them directly.

Image Aspect Ratio Output Parameters:

aspect_number

This output provides the aspect ratio as a numerical value. It represents the ratio of the width to the height of the image, giving you a precise understanding of the image's dimensions.

aspect_float

This output also provides the aspect ratio as a floating-point number, which is essentially the same as the aspect_number but in a different format. This can be useful for further calculations or when a floating-point representation is required.

is_landscape_bool

This output is a boolean value indicating whether the image is in landscape mode. A value of 1 means the image is in landscape mode (width is greater than height), while a value of 0 means it is not. This helps you quickly determine the orientation of the image.

aspect_ratio_common

This output provides the aspect ratio in a common format, such as "16:9" or "4:3". It simplifies the aspect ratio into a more recognizable and standard representation, which can be useful for various applications, including printing and display settings.

aspect_type

This output provides a textual description of the aspect ratio type, indicating whether the image is in "landscape", "portrait", or "square" format. This helps you understand the general orientation and shape of the image at a glance.

Image Aspect Ratio Usage Tips:

  • Use the image parameter when you have an image tensor and want to quickly determine its aspect ratio without manually inputting dimensions.
  • When working with known dimensions, input the width and height parameters directly to get precise aspect ratio calculations.
  • Utilize the aspect_ratio_common output to get a standard representation of the aspect ratio, which can be useful for setting up displays or printing.
  • Check the is_landscape_bool output to quickly determine if your image is in landscape mode, which can help in making decisions about image composition and layout.

Image Aspect Ratio Common Errors and Solutions:

WAS_Image_Aspect_Ratio must have width and height provided if no image tensor is supplied.

  • Explanation: This error occurs when neither an image tensor nor width and height values are provided to the node.
  • Solution: Ensure that you provide either an image tensor through the image parameter or both width and height values to avoid this error.

Image Aspect Ratio Related Nodes

Go back to the extension to check out more related nodes.
WAS Node Suite
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.