ComfyUI Node

萌宝AI·网格选图

Take tile 6 and leave the other eight alone

By Corkery520·Created 3 days ago·Updated 3 days ago· 0
萌宝AI·网格选图
  • image
  • tile
  • row
  • column
grid2x2
custom_rows2
custom_cols2
row1
column1

Here's the annoyance ImageGridTilePicker (萌宝AI·网格选图) exists to remove. You generated a 3x3 sheet, you like one cell, and you want to send that cell into the next stage - one upscale, one inpaint, one subject swap. Running ImageGridSplit upstream gives you nine frames, and now every node behind you processes nine images, costs nine calls, and saves nine files. Expanding the batch is not the goal. Selecting from it is.

This node does the selection: give it a grid and a row/column, get exactly one image out.

How it works

Pick grid (2x2, 3x3, 4x4, or custom with custom_rows/custom_cols, 1–16), then row and column, both 1-indexed - row=1, column=1 is the top-left cell, not the top-right of a zero-based scheme. The tile size is height // rows by width // cols, the slice is taken at (row-1) * tile_h, (column-1) * tile_w, and row/column are clamped into the grid before anything is computed. Ask for row 7 in a 3x3 and you quietly get row 3.

The output is a single-frame IMAGE, so nothing downstream inflates.

The subtlety that catches people

ImageGridSplit with trim_to_even_tiles on center-trims the image to a multiple of the tile size, then slices. ImageGridTilePicker doesn't trim - it slices floor-sized tiles straight from the top-left corner. On a 1000x1000 image with a 3x3 grid they agree exactly (999 used, 1px off the right/bottom). On a 1085x1085 with 3x3, the splitter shifts everything by half a pixel of remainder, while the picker starts at pixel 0. For most work you'll never see it; for pixel-exact stitching, crop your source to a clean multiple first.

Also worth knowing: if you want several specific cells, you need several pickers (or one splitter). Each picker instance is one cell, which is fine in practice - the nodes are tiny and the wiring is obvious, which is more than can be said for most grid math.

Inputs and outputs

Inputs: image, grid, custom_rows, custom_cols, row, column. Outputs: tile (IMAGE, one frame), plus row and column as INTs - the clamped values, so a log line or a filename builder downstream reports the cell you actually got rather than the one you asked for. That's the same "tell the truth about what happened" habit the crop node in this pack has.

Typical wiring: load or generate a sheet → picker → upscaler / detailer / save. Or picker → constraint node → save for a platform with a size cap.

Installing it

ImageGridTilePicker ships in ComfyUI-MengBaoAI, the 17-node Corkery520 pack (MIT, Registry id mengbaoai). Manager users search MengBaoAI, mengbaoai, or 萌宝AI; CLI users run comfy node install mengbaoai. While the first Registry release is still clearing scanning, the Git install is the reliable path:

cd ComfyUI/custom_nodes
git clone https://github.com/Corkery520/ComfyUI-MengBaoAI.git
cd ComfyUI-MengBaoAI
python -m pip install -r requirements.txt

requirements.txt is numpy, Pillow, requests - the heavy lifting is torch, which ComfyUI already provides. Don't let pip touch torch or the CUDA build. Restart ComfyUI and search ImageGridTilePicker, 网格选图, or 萌宝.

If you've been running the old standalone WANG split/crop plugin, disable it before this pack loads - the README flags duplicate node IDs and duplicate HTTP routes as the reason.

Things that bite

  • Off-by-one on row/column. The inputs start at 1. Typing 0 gets clamped to 1, which looks like "it ignored me" rather than an error.
  • Rows and columns from the dropdown vs custom. If grid is 2x2 your custom_rows/custom_cols do nothing; that trips people who set custom numbers and forget the dropdown.
  • A sheet the model didn't really lay out as a grid - 3x3 asked for, but items drift a few percent - will hand you a tile with a neighbour's edge in it. Nothing here can fix that; it's a generation problem, not a slicing problem.
Category萌宝AI/图像处理

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
gridCOMBO2x24 options: 2x2, 3x3, 4x4, custom
custom_rowsINT21–16
custom_colsINT21–16
rowINT11–16
columnINT11–16

Outputs (3)

NameTypeDescription
tileIMAGE
rowINT
columnINT