π² Load 2x2 Grid Series (nhk)
Slices every image in a folder into its 2x2 grid cells β reading order, on autopilot
- image
- filename
- current_index
- total_images
- grid_position
- position_name
If your source images aren't images at all but 2x2 contact grids - four generations composited into one PNG - then the stock LoadImage is useless to you and every manual crop is a tax on your patience. Load2x2GridSeries is the node that treats each file in a folder as a 2x2 grid and hands you one cell at a time, in reading order, on autopilot: upper-left, upper-right, bottom-left, bottom-right, then on to the next file. It's a sibling of LoadImageSeries, same counter mechanics, one extra trick: it splits.
This is the pattern the pack is built around, so if you've used LoadImageSeries you already know the drill - mode, path, pattern, label, reset. The new bit is separator_width.
How it works
Each source image is cut into four quadrants (width // 2 by height // 2). The node keeps a per-label in-memory counter just like LoadImageSeries, but now the sequence is measured in cells, not files: total_grid_cells = number_of_files Γ 4. So index 0β3 are file 1's four quadrants, index 4β7 are file 2's, and so on, wrapping around at the very end.
- single_image mode loads by index and auto-advances one cell per run;
resetsends it back to cell 0. - random mode picks a random cell (0 to cellsβ1) from a seeded RNG - same seed, same cell.
- separator_width (default 0) is for grids that have a visible divider line between cells. If your composites were built with a 2px gutter down the middle, a naive
width//2crop will slice through the line and give you sloppy edges. Setseparator_widthto the line thickness and the node crops around it, excluding those pixels from each quadrant.
Outputs tell you exactly where you are in the whole sequence: image (the cropped cell), filename (the source file it came from), current_index (cell index across all files), total_images (total cells = files Γ 4), plus grid_position (0β3) and position_name ("upper-left", "upper-right", "bottom-left", "bottom-right").
Installing
Standard pack install, no model downloads, no extra dependencies:
cd ComfyUI/custom_nodes
git clone https://github.com/Enashka/ComfyUI-nhknodes
or ComfyUI Manager β search "NHK Nodes" β install β restart. It shows up under nhk/image.
Where people get burned
- Cropped cells have white/black slivers on the edges. Your grids have a separator gutter and
separator_widthis 0. Measure the gutter and set it - the whole point of that input is fixing exactly this. - "It's skipping whole files / repeating cells." The counter tracks cells, not files. If you're expecting per-file steps, remember a "step" here is one quadrant.
position_nameon the output tells you which corner of which file you're on - trust that over guessing. - Odd dimensions. It's integer division, so a grid with an odd pixel width loses a column of pixels to the split. Not much you can do about it, but it's worth knowing the last pixel column/row effectively disappears.
- Same counter trap as its sibling. Change folders without changing the
labeland it'll pick up where the old sequence left off. Fresh label orresetwhen you repoint it.
This node exists for one specific workflow - "my dataset/outputs are 2x2 grids and I want each cell as its own frame" - and for that job it's the best of the bunch. If you've got 3x3 grids instead, grab its sibling Load3x3GridSeries; the logic is identical, just 9 cells per file.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | single_image: load by index (use with control_after_generate=increment for sequences), random: load random grid cell by seed | |
| path | STRING | Directory path containing grid images to load | |
| pattern | STRING | * | Glob pattern to filter files (e.g., '*.png', 'img_*.jpg', '**/*.png' for recursive) |
| index | INT | 0 | Starting index for single_image mode (auto-increments with control_after_generate) |
| seed | INT | 0 | Seed for random mode (same seed = same random grid cell) |
| label | STRING | Grid2x2_001 | Unique identifier for tracking this sequence independently from others |
| reset | BOOLEAN | false | Reset counter back to index 0 |
| separator_width | INT | 00β100 | Width of separator lines between grid cells (in pixels). Excludes this many pixels from center cross. |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| filename | STRING | β |
| current_index | INT | β |
| total_images | INT | β |
| grid_position | INT | β |
| position_name | STRING | β |