Resolution from Dimensions:
ResolutionFromDimensions calculates a new image resolution from existing dimensions while aiming for a selected pixel budget. It scales both dimensions by the same factor to retain the original shape, then rounds each dimension down to a chosen size increment. This helps you prepare dimensions for an image-generation workflow without manually calculating a scale factor. Because the rounding happens after scaling, the final pixel count can be below the target and the aspect ratio can shift slightly.
Resolution from Dimensions Input Parameters:
width
The starting image width in pixels. Together with height, it establishes the shape that the calculated resolution aims to retain; it does not set the final width directly. The interface accepts integers from 8 to 7680 in steps of 1. No default is specified in the provided source.
height
The starting image height in pixels. Together with width, it determines the starting shape and the scale needed to approach the selected pixel budget. The interface accepts integers from 8 to 7680 in steps of 1. No default is specified in the provided source.
pixelbudget
The target size category used to calculate the new dimensions. Each dropdown choice maps to a numeric value; the node uses that value to define a target pixel area equivalent to the value squared, multiplied by 16/9. The available choice names, their numeric values, and a default are not present in the provided source because the dropdown comes from PIXEL_BUDGET_LIST. Choose from the options shown in your installed node rather than assuming a particular preset exists.
multiple
The size increment for both calculated dimensions. After scaling, the node rounds each dimension down to the nearest multiple of this value. A larger increment may move the final pixel count farther below the target, especially for small images. The default is 32; the allowed range is 1 to 64 in steps of 1. The interface tooltip suggests 32 for MiniMaxH3, 8 for Illustrious/Pony, and 16 for other uses; confirm the requirements of the model you are using.
Resolution from Dimensions Output Parameters:
width
The calculated width in pixels, returned as an integer. It is the scaled starting width rounded down to a multiple of multiple, so it may be smaller than the width obtained from scaling alone. Use this value as the width setting in a downstream node.
height
The calculated height in pixels, returned as an integer. It is scaled by the same factor as the starting width and then rounded down independently to a multiple of multiple. Use it alongside the calculated width rather than pairing it with the original width.
longest
The larger of the calculated width and height values, in pixels. This gives you the final long-edge size at a glance, whether the result is landscape, portrait, or square.
megapixels
The final calculated pixel count expressed in megapixels, returned as a floating-point number. The node computes it as calculated width × calculated height ÷ 1024 ÷ 1024. It reflects the dimensions after rounding, not the unrounded target budget; the node therefore uses 1,048,576 pixels per displayed megapixel.
Resolution from Dimensions Usage Tips:
- Enter the dimensions of the shape you want to preserve. For example, starting with a wider-than-tall image produces a wider-than-tall result, although rounding can alter the ratio slightly.
- Select a
pixelbudgetoption based on the approximate output size you need, then checkmegapixelsto see the pixel count actually produced after rounding. - Set
multipleto the increment required by your downstream workflow. The source tooltip suggests 32 for MiniMaxH3, 8 for Illustrious/Pony, and 16 for other uses, but those suggestions do not verify compatibility with every setup. - If the result falls noticeably below the intended budget, try a smaller compatible
multiple. Rounding down in smaller increments generally discards fewer pixels. - Pass both calculated dimensions to downstream size settings. Using one calculated dimension with one original dimension would lose the pair this node computed.
Resolution from Dimensions Common Errors and Solutions:
Width or height is outside the allowed range
- Explanation: The interface specifies a minimum of 8 and a maximum of 7680 for each starting dimension. The exact validation message depends on the host and is not defined in this node source.
- Solution: Enter whole-number values from 8 through 7680 for both
widthandheight.
Multiple is outside the allowed range
- Explanation: The interface allows
multiplevalues from 1 through 64. An out-of-range value may be rejected by interface validation; the exact message is not specified in the source. - Solution: Choose a whole number from 1 to 64 that meets your downstream workflow’s requirements.
Invalid pixelbudget selection
- Explanation: The calculation looks up
pixelbudgetinPIXEL_BUDGET_LIST. A value that is not a key in that mapping cannot be looked up. The list and its possible error messages are not included in the provided source. - Solution: Select an option from the node’s current dropdown. If a saved workflow refers to an unavailable option, reselect an available one in the installed version.
Calculated width or height is zero
- Explanation: The node rounds each scaled dimension down to a multiple of
multiple. If a scaled dimension is smaller than that increment, rounding produces zero. The source does not raise a dedicated error for this condition, but a downstream image node may reject the result. - Solution: Check the calculated
widthandheightbefore using them. Try a smallermultipleor a different availablepixelbudgetthat yields larger dimensions.
Final megapixels are lower than expected
- Explanation: The pixel budget determines the scale before rounding. Rounding both dimensions down reduces the final pixel count, and the source does not adjust them again afterward. This is an expected result, not an error message.
- Solution: Use the
megapixelsoutput to assess the actual result. If your workflow permits it, reducemultipleto limit the amount rounded away.
Aspect ratio is not exactly preserved
- Explanation: Both starting dimensions receive the same scale factor, but each is subsequently rounded down separately. That can make the final width-to-height ratio slightly different from the starting ratio; the source does not report this as an error.
- Solution: Use a smaller compatible
multiplewhen a closer match matters, and check the finalwidthandheightbefore generating an image.
