ComfyUI > Nodes > ComfyUI-LogicUtils > Random Width/Height with Resolution

ComfyUI Node: Random Width/Height with Resolution

Class Name

DimensionSelectorWithSeedNode

Category
Logic Gates
Author
aria1th (Account age: 3016days)
Extension
ComfyUI-LogicUtils
Latest Updated
2026-01-21
Github Stars
0.1K

How to Install ComfyUI-LogicUtils

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

Random Width/Height with Resolution Description

Generates image dimensions with specified resolution, aspect ratio, and seed for reproducibility.

Random Width/Height with Resolution:

The DimensionSelectorWithSeedNode is designed to assist in generating dimensions for images or other graphical elements based on a specified resolution and aspect ratio range. This node is particularly useful when you need to maintain a specific area size while allowing for variability in the width and height, ensuring that the dimensions adhere to a given aspect ratio. By incorporating a seed for randomness, the node can produce consistent results across different runs, which is beneficial for reproducibility in artistic workflows. The node's primary function is to calculate dimensions that fit within a specified resolution, while also allowing for flexibility in the aspect ratio and ensuring that the dimensions are multiples of a specified value. This makes it an essential tool for artists who need to generate images with specific constraints, providing both precision and variability in the creative process.

Random Width/Height with Resolution Input Parameters:

resolution

The resolution parameter defines the target area size for the dimensions to be calculated. It is used to determine the overall size of the output dimensions, ensuring that the width and height, when multiplied, approximate the square of this resolution value. This parameter is crucial for maintaining the desired scale of the output dimensions.

min_ratio

The min_ratio parameter specifies the minimum aspect ratio that the output dimensions can have. It ensures that the width-to-height ratio does not fall below this value, allowing for control over the shape of the output dimensions. This parameter is important for maintaining the visual proportions of the generated dimensions.

max_ratio

The max_ratio parameter sets the maximum aspect ratio for the output dimensions. It ensures that the width-to-height ratio does not exceed this value, providing a boundary for the shape of the output dimensions. This parameter helps in maintaining the desired proportions and preventing overly stretched or compressed dimensions.

multiples

The multiples parameter ensures that the calculated width and height are rounded to the nearest multiple of this value. This is particularly useful for ensuring compatibility with certain display or processing requirements that may require dimensions to be aligned to specific multiples.

seed

The seed parameter is used to initialize the random number generator, allowing for reproducible randomness in the calculation of dimensions. By setting a specific seed value, you can ensure that the same input parameters will consistently produce the same output dimensions, which is useful for achieving consistent results across different runs.

Random Width/Height with Resolution Output Parameters:

width

The width output parameter represents the calculated width of the dimensions based on the input parameters. It is determined by the specified resolution, aspect ratio range, and multiples, ensuring that it fits within the desired constraints while maintaining the specified area size.

height

The height output parameter represents the calculated height of the dimensions. Like the width, it is determined by the resolution, aspect ratio range, and multiples, ensuring that it adheres to the specified constraints and maintains the desired area size.

Random Width/Height with Resolution Usage Tips:

  • To achieve consistent results across different runs, use the same seed value when generating dimensions with the same input parameters.
  • Adjust the min_ratio and max_ratio parameters to control the shape of the output dimensions, ensuring they fit your specific artistic or display requirements.
  • Use the multiples parameter to ensure that the output dimensions are compatible with specific processing or display requirements that require dimensions to be aligned to certain multiples.

Random Width/Height with Resolution Common Errors and Solutions:

Invalid resolution value

  • Explanation: The resolution value provided is not valid, possibly due to being negative or zero.
  • Solution: Ensure that the resolution value is a positive integer that represents the desired area size for the dimensions.

Aspect ratio out of bounds

  • Explanation: The specified min_ratio or max_ratio values are not within a reasonable range.
  • Solution: Verify that the min_ratio is less than or equal to the max_ratio and that both values are positive and reasonable for the intended output dimensions.

Seed value not set

  • Explanation: The seed value is not set, leading to non-reproducible results.
  • Solution: Set a specific seed value to ensure reproducibility of the output dimensions across different runs.

Random Width/Height with Resolution Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-LogicUtils
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 Models, enabling artists to harness the latest AI tools to create incredible art.