画布媒体处理 & 分辨率 📐
The node that does the math so your canvas tiles line up
- image
- image
- width
- height
CanvasResolutionSelector is the workhorse of this pack, and it's the one node worth understanding before the others. On an infinite canvas you're constantly generating tiles that have to line up with the canvas grid - same size, same aspect, same latent-friendly dimensions - and this node is the gatekeeper that makes those decisions in one place. It takes a media size (or an actual image), applies your constraints, and hands back the final dimensions plus a processed image.
What the knobs do
Three inputs control everything, and they compose:
- max_resolution - caps the longest edge. Pick from 512 up to 2048, or
Disabled. This is the "don't let a 4K reference blow up my sampler" guard, and it only ever scales down; it won't upscale a small image beyond its native size. - aspect_ratio - forces a target shape: 1:1, 4:3, 3:4, 16:9, 9:16, 21:9, or 9:21.
- method - how to reconcile the source ratio with the target when they disagree:
Center Crop(scale up, then crop the center),Stretch(just distort it), orFill White(scale down and pad with white bars).
The method only comes into play when an aspect_ratio is set and the source doesn't already match it. And here's a subtlety: final dimensions get rounded down to a multiple of 8 before they're returned. That's because latents live at 1/8 the pixel resolution - a size that isn't a multiple of 8 can make samplers throw or quietly produce sloppy results. So a 16:9 request at max 1024 gives you something like 1024×576, not an exact 16:9, and that's by design.
Outputs: the INTs are the star
- image - the processed image (or, if you fed it no image, an all-zero black tensor at the computed size).
- width and height - the final dimensions, always multiples of 8.
The no-image mode is the sleeper feature. Wire nothing into the optional image input and this becomes a pure "give me the right canvas dimensions" calculator: it returns a black placeholder plus the two INTs, which you then feed straight into an EmptyLatentImage - exactly what the pack's shipped Text-to-image workflow does (CanvasResolutionSelector → INT → EmptyLatentImage → KSampler). That's the tidy way to size a text-to-image generation so every tile comes out canvas-compatible.
The takes
Stretch is a trap. It distorts your reference to hit the ratio, and it's almost never what you want for anything but a rough placeholder. Center Crop quietly eats edges - fine if the edges are irrelevant, expensive if they're not. Fill White pads with flat white bars, which is actually the most useful of the three if you're doing outpainting: pad the canvas with a solid color, tell an instruction model to extend into it, and let it repaint over the padding. That's the classic "pad and repaint" outpainting trick, and this node gives you the padding for free.
Install
Same routine as the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/zml-w/ComfyUI-Infinite-Canvas
Restart, or install via ComfyUI Manager (search "ComfyUI-Infinite-Canvas"), and add --enable-cors-header to ComfyUI's startup args for the Infinite Canvas frontend - the README's one explicit setup requirement. Dependencies are light: opencv-python and imageio-ffmpeg. Look for it under the 无限画布 category, displayed as 画布媒体处理 & 分辨率 📐.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| max_resolution | COMBO | Disabled | 7 options: Disabled, 512, 768, 1024, 1280, 1536, +1 |
| aspect_ratio | COMBO | Disabled | 8 options: Disabled, 1:1, 4:3, 3:4, 16:9, 9:16, +2 |
| method | COMBO | Center Crop | 3 options: Center Crop, Stretch, Fill White |
| imageopt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |