๐ Size (Drawer)
Pick an aspect ratio, dial the megapixels, skip the resolution math
- width
- height
- megapixels
- ratio
Somewhere in every ComfyUI workflow someone is doing resolution arithmetic by hand - "16:9 at 1.5 megapixels, so that's... 1504ร896?" DrawerSize is the node that does that math for you. Pick an aspect ratio, set a megapixel budget, and it hands you clean width and height integers rounded to a multiple of 16, which is what the latent models actually like.
It's one of the nine utility nodes in ComfyUI-Drawer, Kuroi's mobile-friendly drawer platform. Where it shines is the Deck: in the drawer you get aspect-ratio chip presets and a megapixel slider instead of two number boxes, which is exactly what you want when the "keyboard" is a tablet screen.
What it computes
Four inputs:
- ratio_ - an enum:
custom,1:1,4:3,3:2,16:9,21:9,9:16,2:3,3:4. Everything butcustomis a preset that recalculates width/height from the ratio. - megapixels_ - a float, 0.25 to 4.0, step 0.05. Your resolution budget.
- width_ / height_ - ints, 64 to 8192, step 16. Only used when
ratio_iscustom.
Four outputs: width, height, megapixels, and ratio (the enum string passes through).
The mechanism is simple: for a non-custom ratio it solves for width and height that hit the megapixel target at that aspect ratio, then rounds each side to the nearest 16 with a 64px floor. In custom mode it just rounds your typed width/height to 16 and passes them through. The megapixels output is the actual value after rounding - so what it reports is what your latent really gets, which is the honest number for EXIF/filename purposes.
Wire width and height into an Empty Latent Image, or convert those widgets to inputs on a sampler chain. The ratio string output is handy for filenames or conditioning logic - e.g. a filename prefix that records 16:9.
Installing it
DrawerSize ships with the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Kuroi961/ComfyUI-Drawer.git
pip install -r ComfyUI-Drawer/requirements.txt
Or just search ComfyUI-Drawer in ComfyUI Manager. requirements.txt is a single line (Send2Trash), and there are no model files to download for any of these nodes.
Gotchas
The one that trips everyone: when a ratio is selected, your hand-typed width_/height_ are ignored. That's by design - a preset supersedes manual dims. Want exact pixels? Set ratio_ to custom.
Second: 16-rounding means a "1.5 MP, 16:9" request isn't exactly 1.5 MP when it comes out the other end. The node knows and reports the real number. If you need a very specific resolution, custom is your friend.
It's a small utility, but for anyone handing a workflow to a less-technical user, or running ComfyUI on a phone, it converts "type 1504ร896 into the box" into "pick 16:9, set 1.5" - and that's the whole difference between usable and not.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| ratio_ | COMBO | custom | 9 options: custom, 1:1, 4:3, 3:2, 16:9, 21:9, +3 |
| megapixels_ | FLOAT | 1.000.25โ4 | โ |
| width_ | INT | 102464โ8192 | โ |
| height_ | INT | 102464โ8192 | โ |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| width | INT | โ |
| height | INT | โ |
| megapixels | FLOAT | โ |
| ratio | custom,1:1,4:3,3:2,16:9,21:9,9:16,2:3,3:4 | โ |