ComfyUI > Nodes > ComfyUI_Lam > 宽高比

ComfyUI Node: 宽高比

Class Name

AspectRatio

Category
lam
Author
Lam Yan (Account age: 3065days)
Extension
ComfyUI_Lam
Latest Updated
2025-03-06
Github Stars
0.02K

How to Install ComfyUI_Lam

Install this extension via the ComfyUI Manager by searching for ComfyUI_Lam
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI_Lam 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

宽高比 Description

Facilitates image dimension management based on aspect ratios for AI artists, streamlining workflow and ensuring aesthetic consistency.

宽高比:

The AspectRatio node is designed to facilitate the management and calculation of image dimensions based on predefined aspect ratios. This node is particularly useful for AI artists who need to ensure their images maintain specific proportions, which is crucial for aesthetic consistency and technical requirements in digital art projects. By providing a selection of common aspect ratios, the node simplifies the process of determining the appropriate width and height for an image, ensuring that the final output adheres to the desired proportions. This functionality is essential for tasks such as preparing images for different display formats or ensuring compatibility with various digital platforms. The node's primary goal is to streamline the workflow for artists by automating the aspect ratio calculation, thus allowing them to focus more on the creative aspects of their work.

宽高比 Input Parameters:

aspect_ratio

The aspect_ratio parameter allows you to select from a list of predefined aspect ratios, each represented in the format of width×height followed by the ratio (e.g., 704×1408 ∣ 1:2). This parameter is crucial as it determines the proportions of the image you are working with. The default value is 1152×896 ∣ 9:7, but you can choose from a variety of options to suit your specific needs. Selecting the correct aspect ratio ensures that your image maintains the intended visual balance and fits the desired format.

width

The width parameter specifies the width of the image in pixels. It is an integer value with a default of 0, which means that if no specific width is provided, the node will use the width from the selected aspect ratio. The minimum value is 0, and the maximum is 99999. This parameter allows for customization if you need a specific width that differs from the predefined aspect ratios.

height

The height parameter defines the height of the image in pixels. Similar to the width parameter, it is an integer with a default value of 0. If no height is specified, the node will default to the height from the chosen aspect ratio. The range for this parameter is from 0 to 99999. This flexibility is useful when you need to adjust the height independently to meet particular project requirements.

宽高比 Output Parameters:

The (width) output parameter provides the calculated width of the image based on the selected aspect ratio and any custom width input. This output is essential for ensuring that the image's width aligns with the desired aspect ratio, maintaining the visual integrity of the artwork.

The (height) output parameter delivers the calculated height of the image, taking into account the chosen aspect ratio and any specified height input. This output ensures that the image's height is consistent with the intended proportions, which is vital for achieving the correct visual presentation.

宽高比 Usage Tips:

  • When working with images that need to fit specific display formats, use the predefined aspect ratios to quickly set the correct dimensions without manual calculations.
  • If you have specific width or height requirements, input these values directly to override the defaults while still maintaining the overall aspect ratio.

宽高比 Common Errors and Solutions:

Invalid aspect ratio format

  • Explanation: This error occurs when the aspect ratio string is not in the expected format of width×height ∣ ratio.
  • Solution: Ensure that the aspect ratio is selected from the provided list or formatted correctly if input manually.

Width or height out of range

  • Explanation: This error happens when the specified width or height exceeds the allowed range of 0 to 99999. - Solution: Adjust the width or height values to fall within the acceptable range.

Both width and height are zero

  • Explanation: If both width and height are set to zero, the node cannot determine the dimensions.
  • Solution: Either select a predefined aspect ratio or specify at least one non-zero dimension.

宽高比 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI_Lam
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.