Visit ComfyUI Online for ready-to-use ComfyUI environment
Calculate image dimensions based on aspect ratio and target size for maintaining proportions in artwork, ensuring appropriate scaling and optional adjustments for alignment.
The "Width and height from aspect ratio 🪴" node is a utility designed to calculate the dimensions of an image based on a specified aspect ratio and a target size. This node is particularly useful for AI artists who need to maintain specific proportions in their artwork while adjusting the overall size. By providing a target size, the node ensures that the resulting dimensions are scaled appropriately, maintaining the desired aspect ratio. This functionality is essential for creating images that fit specific display or print requirements without distortion. The node also allows for optional adjustments to ensure that the dimensions are multiples of a specified value, which can be crucial for certain applications where alignment or grid fitting is necessary.
The aspect_ratio
parameter defines the proportional relationship between the width and height of the image. It is specified as a string in the format "width:height", such as "16:9" or "4:3". This parameter is crucial as it dictates the shape of the resulting image. The available options include common aspect ratios like "1:1", "16:9", and "4:3", among others. The default value is "1:1", which represents a square image.
The target_size
parameter specifies the desired size of the image in terms of its largest dimension, either width or height, depending on the aspect ratio. It is an integer value with a default of 1024, and it can range from a minimum of 64 to a maximum of 8192. This parameter determines the scale of the image while maintaining the specified aspect ratio.
The multiple_of
parameter is optional and allows you to specify a value that the resulting width and height should be multiples of. This can be important for ensuring compatibility with certain systems or requirements that necessitate dimensions to be aligned to specific grid sizes. The default value is 8, with a range from 1 to 1024.
The width
output parameter represents the calculated width of the image based on the specified aspect ratio and target size. It is an integer value that ensures the image maintains the desired proportions while fitting within the target size constraints.
The height
output parameter represents the calculated height of the image, similar to the width, ensuring that the image maintains the specified aspect ratio. This value is also adjusted to fit within the target size constraints and is a multiple of the specified multiple_of
parameter if provided.
multiple_of
parameter to ensure that the resulting dimensions are compatible with systems that require specific alignment, such as certain display technologies or printing processes.multiple_of
parameter must be between 1 and 1024.multiple_of
parameter to a valid value within the specified range.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.