萌宝AI·图片拆分
One 3x3 sheet in, nine images out
- image
- tiles
- rows
- columns
- tile_count
Contact sheets are back. Nano Banana, gpt-image-2 and friends will happily give you a single 3x3 grid of product shots, sticker variants, or character poses in one call - cheaper and faster than four separate trips. Then you're stuck holding one image where you wanted nine. ImageGridSplit (萌宝AI·图片拆分) is the cheap, unglamorous node that fixes that: give it a grid size and get the tiles back as a batch you can save, upscale, or feed to a second pass.
How the split works
Pick grid from 2x2, 3x3, 4x4, or custom (with custom_rows and custom_cols, 1–16 each). Tile size is floor(height / rows) by floor(width / cols) - the leftover pixels from an indivisible image are the interesting part, and trim_to_even_tiles decides what happens to them:
- On (the default): the image is center-trimmed to the nearest whole multiple of the tile size before slicing. 1024 divided by 3 is 341.33; you get three 341px columns and 1px of margin cropped off the sides. Nothing is resampled, so no soft edges.
- Off: the image is resized, bilinearly, down to the largest whole-tile-sized rectangle that fits. Every tile is the same size and the whole picture survives, at the cost of a slight rescale.
Then the node walks the grid row by row, left to right, top to bottom - Western reading order, and the tile order is fixed, not shuffled. So in a 2x2, tile 1 is top-left and tile 4 is bottom-right, which is exactly the order a downstream batch index refers to. After slicing, all tiles are stacked into one batch tensor (they're guaranteed the same shape, which is why that trim-or-resize step exists at all).
If the grid is larger than the image - a 16x16 on a 128px thumbnail - it raises Grid is too large for the input image size rather than handing you empty tensors.
Inputs and outputs
image is the only required wire. The knobs that matter are grid and trim_to_even_tiles; the two custom_* integers are ignored unless grid is set to custom. Four outputs come back:
tiles- the IMAGE batch, one frame per tilerows,columns- the resolved grid, useful when you derived it from a dropdown and other nodes need the numberstile_count- rows × columns
Practically, you wire tiles into a save node (they'll all write at once, numbered), into an upscale pass, or into a second-stage image-to-image where each tile gets refined. tile_count is the one to feed anything that iterates.
One caveat on the batch: everything downstream now sees N frames per prompt, so a batch-aware sampler will chew through all of them. That's usually what you want, and when it isn't, you wanted the tile picker instead.
Installing it
This node lives in ComfyUI-MengBaoAI, a 17-node pack by Corkery520 (MIT, Registry id mengbaoai). Manager route: search MengBaoAI / mengbaoai / 萌宝AI, or comfy node install mengbaoai. Because Registry availability depends on the first release clearing platform scanning, the Git route is the one that always works:
cd ComfyUI/custom_nodes
git clone https://github.com/Corkery520/ComfyUI-MengBaoAI.git
cd ComfyUI-MengBaoAI
python -m pip install -r requirements.txt
Requirements are numpy, Pillow, requests - light, nothing to compile, no model downloads. Use the Python that ComfyUI actually runs on (portable Windows builds: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt). Restart and search the canvas for ImageGridSplit, 图片拆分, or 九宫格, which is the alias the author registered for this one.
The same pack used to exist as separate WANG plugins (WANG_image_split_crop_nodes among them). Disable those first - duplicate node IDs will bite you.
Things that bite
- Tiles from a generated sheet aren't cut where you think. An image model asked for a 3x3 grid rarely lays it out on exact thirds, so tiles often carry a sliver of the neighbour. Trimming won't save you from the model's own positioning; if you need clean cuts, ask for gutters or generate each image separately.
tilesis a batch, not a list. If something downstream complains about shape or processes only the first frame, that's the mismatch - split the batch or use ImageGridTilePicker for one tile.- Odd dimensions drift. 1085x1085 on a 2x2 gives you 542px tiles plus a wasted pixel; with trimming on, that pixel comes off the edges, not the middle of one tile.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| grid | COMBO | 2x2 | 4 options: 2x2, 3x3, 4x4, custom |
| custom_rows | INT | 21–16 | — |
| custom_cols | INT | 21–16 | — |
| trim_to_even_tiles | BOOLEAN | true | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| tiles | IMAGE | — |
| rows | INT | — |
| columns | INT | — |
| tile_count | INT | — |