Visit ComfyUI Online for ready-to-use ComfyUI environment
Dynamically calculate canvas dimensions with aspect ratio control for precise resizing in ComfyUI Node.
The canvas-util-cal-size
node is designed to help you dynamically calculate the dimensions of a canvas based on various input parameters. This node is particularly useful when you need to maintain specific aspect ratios or adjust dimensions while keeping one dimension locked. It provides flexibility in resizing canvases by allowing you to specify width, height, aspect ratio, and whether to reverse the dimensions. This node is essential for AI artists who need precise control over canvas sizes for their creative projects, ensuring that the final output meets their exact specifications.
This parameter specifies the width of the canvas. It accepts integer values with a default of 512, a minimum of 0, and a maximum of 10,000,000. Adjusting this value will directly impact the width of the canvas unless the lockoff
parameter is set to lock the width.
This parameter specifies the height of the canvas. It accepts integer values with a default of 512, a minimum of 0, and a maximum of 10,000,000. Adjusting this value will directly impact the height of the canvas unless the lockoff
parameter is set to lock the height.
This parameter determines whether to lock the width or height when calculating the canvas size. It accepts three options: "false", "w", and "h". When set to "w", the width is locked, and the height is adjusted based on the aspect ratio. When set to "h", the height is locked, and the width is adjusted based on the aspect ratio. The default value is "false".
This parameter specifies the aspect ratio for the canvas in the format "width:height". It accepts a string value with a default of "1:1". This ratio is used to calculate the other dimension when one dimension is locked using the lockoff
parameter.
This parameter determines whether to reverse the calculated width and height. It accepts two options: "false" and "true". When set to "true", the calculated width and height are swapped. The default value is "false".
This output parameter represents the calculated width of the canvas after considering the input parameters and any adjustments made based on the aspect ratio and lock settings. It is an integer value.
This output parameter represents the calculated height of the canvas after considering the input parameters and any adjustments made based on the aspect ratio and lock settings. It is an integer value.
rate
parameter to your desired ratio and use the lockoff
parameter to lock either the width or height.reverse
parameter to "true" to easily achieve this without manually adjusting the values.rate
parameter must be in the format "width:height".rate
parameter is a string in the correct format, such as "16:9" or "4:3".w
or h
parameter values exceed the allowed range.w
and h
values are within the range of 0 to 10,000,000.rate
parameter results in a division by zero.rate
parameter to ensure it does not contain zero values, such as "0:1" or "1:0".© Copyright 2024 RunComfy. All Rights Reserved.