(Deno) Resize Box
Pick a resolution once, wire it everywhere, stop doing the math
- image
- image
- width
- height
Every serious ComfyUI workflow eventually becomes a pile of width/height widgets that all need to agree, and when you change the target resolution you get to hunt down every one of them. (Deno) Resize Box is the pack's answer: one node where you define the size once - by preset ratio, by megapixels, or by hand - and it hands you clean width and height integers to wire into your latent, sampler, and empty-latent nodes, plus an optional resized image if you feed one in. Change one node, and every downstream consumer updates.
How it works
Three modes:
- Preset Ratio (default) - pick
ratio_preset(16:9 default, 13 presets total) and amegapixelstarget (1.0 default). The node computes the actual width/height from those two numbers. - Manual Input - you type
widthandheightdirectly (both 1024 default). - Keep Input Ratio - derive the size from the connected input image.
divisible_by (default 32) rounds the result to a model-safe multiple - the single most common source of "my latent is the wrong shape" errors, handled here instead of by you doing mental arithmetic. There's a live ratio/size preview right in the node, so you see what you're about to get.
The image path is worth knowing: if you connect an image, the node resizes it with resize_method (Center Crop (Fill) or Fit) and interpolation (lanczos default) and outputs it. If you don't connect one, it still works - it creates a blank image at the chosen size. So the node doubles as a plain resize box and a pure resolution calculator, depending on whether image is connected.
Inputs and outputs
mode,ratio_preset,megapixels,width,height,divisible_by,resize_method,interpolation.- Optional
image- resize it, or leave empty for the blank-image fallback. - Outputs:
image,width,height.
Install and the honest take
cd ComfyUI/custom_nodes
git clone https://github.com/Deno2026/comfyui-deno-custom-nodes.git
# restart ComfyUI
No dependencies. This is a genuinely thin utility node, and that's fine - it's the kind of node you install the pack for without thinking about it.
The thing to keep straight: width and height are plain integers, so this node shines when your workflow routes those integers around (empty latents, text encoders, upscalers that take explicit sizes). If your workflow instead relies on a single "resolution preset" that also drives other things - aspect, megapixel budget, filename - you'll still want a settings node for that. Where people do get bitten: forgetting that divisible_by applies in all modes, so a "manual" 1000×1000 becomes 992×992 or similar - check the preview before wiring it into something that demanded an exact multiple and then silently did its own rounding.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Preset Ratio | Choose how the output size is decided: preset ratio, manual width/height, or the input image ratio. |
| ratio_preset | COMBO | 16:9 | Target aspect ratio used in Preset Ratio mode. |
| megapixels | FLOAT | 1.000.01–10 | Target total image size in megapixels for automatic sizing modes. |
| width | INT | 102464–8192 | Manual or fallback output width in pixels. |
| height | INT | 102464–8192 | Manual or fallback output height in pixels. |
| divisible_by | COMBO | 32 | Round the final size to a model-safe multiple such as 16 or 32. |
| resize_method | COMBO | Center Crop (Fill) | Choose center crop, draggable crop-position, or fit/letterbox behavior when resizing an input image. |
| interpolation | COMBO | lanczos | Resize filter. Lanczos is the default quality choice. |
| imageopt | IMAGE | Optional source image. If empty, the node creates a blank image at the selected size. | |
| crop_xopt | FLOAT | 0.500–1 | Saved horizontal crop position. Drag inside the Resize Box preview to change it. |
| crop_yopt | FLOAT | 0.500–1 | Saved vertical crop position. Drag inside the Resize Box preview to change it. |
| crop_zoomopt | FLOAT | 1.001–32 | Saved crop zoom. Drag any crop corner while keeping the output aspect ratio locked. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | Resized image, or a blank image if no input image was connected. |
| width | INT | Final output width in pixels. |
| height | INT | Final output height in pixels. |