Nodes/Content Aware Tiles/Random Subset of Batch
ComfyUI Node

Random Subset of Batch

Peek at a handful of tiles

By samsartor·Created 2 years ago·Updated about a year ago· 23
Random Subset of Batch
  • image
  • IMAGE
count1

The simplest node in the pack, and it's not from the tile math at all - it's a general-purpose batch sampler. Give it an IMAGE batch and a count, and it returns that many images chosen at random. In the sample workflow it's used exactly the way you'd guess: after generating a pile of candidate tiles, pick a few at random to preview instead of dumping the whole batch into a viewer.

What it does

Mechanically it's one line of index math - torch.randint over the batch dimension and a gather - so there's no ranking, no seeding controls, no cleverness. It just gives you count random members of the batch. That simplicity is the feature: it's a cheap, honest random sample, which is what you want when you've got a big batch of candidate tiles and you're trying to judge quality. Look at ten random ones, spot a pattern of failures, and you know the fix is upstream (more candidates, different prompt, higher denoise) rather than something wrong with the selection.

Inputs and outputs

  • image (IMAGE) - any batch of images (tiles, or anything else)
  • count (INT, default 1) - how many to pick

Output is a single IMAGE of up to count images. In a tile workflow it slots in right after a boundary node or after TileImages normalizes your tiles, feeding a PreviewImage.

Installing and notes

Standard pack install: git clone https://github.com/samsartor/content_aware_tiles into ComfyUI/custom_nodes (or ComfyUI Manager → "content_aware_tiles") and restart. No models.

Two things worth knowing. First, it's random per run - no seed port - so you'll get a different handful every time you queue; if you want a reproducible subset you'd want a seeded picker (this one isn't it). Second, count larger than the batch will throw, so keep it sane. It's a research-pack convenience node, zero community footprint, and honestly you could reproduce it with two stock nodes - but it's there, it works, and it's the natural preview step in the included workflow.

Categoryimage/batch

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
countINT1

Outputs (1)

NameTypeDescription
IMAGEIMAGE