ComfyUI Node

lay_edge_cut

Slicing one image into a grid of tiles in ComfyUI

By cardenluo·Created 2 years ago·Updated 17 days ago· 309
lay_edge_cut
  • image
  • preview
  • split_image
rows2
cols3
auto_crop_edgefalse
trim_border0

If you've ever wanted to chop one big image into a neat grid of pieces - a poster into print tiles, a texture sheet into individual sprites, a comic page into panels - lay_edge_cut is the node for that. It's the inverse of a contact-sheet node: instead of combining many images into one, it takes one image and cuts it apart.

What it does

The node comes from cardenluo's ComfyUI-Apt_Preset, a large all-in-one pack built around a "Loader → Controller → Sampler" philosophy for taming messy ComfyUI graphs. lay_edge_cut sits in the pack's imgEffect group, alongside the other grid and layout tools. It's a straightforward slicer: give it an image and a rows x cols grid, and it divides the image into that many even tiles.

Two extra knobs make it more than a naive crop-and-split. auto_crop_edge (boolean) trims any solid-color border or dead space around the image before slicing, so you don't end up with a sliver of background baked into your edge tiles. trim_border (an integer, 0–100) shaves a fixed margin off each tile after the cut - handy if you want a small gutter between pieces instead of them touching pixel-to-pixel, similar to a bleed margin in print layout.

Inputs and outputs

  • image - the source image to slice.
  • rows / cols - grid dimensions, 1–10 each. Rows × cols is how many tiles you'll get.
  • auto_crop_edge - auto-trim uniform borders before slicing.
  • trim_border - margin (in pixels-equivalent units, 0–100) trimmed from each resulting tile.

It gives you two outputs: preview, a single IMAGE that's presumably the original with the cut lines visible so you can sanity-check the grid before committing, and split_image, the actual IMAGE output containing the sliced tiles. Wire split_image into whatever consumes a batch - a Save Image node set to save all frames, an upscaler running per-tile, or a loop that processes each piece separately.

Where this fits in a workflow

The obvious use is print prep: split a large generated image into overlapping or gridded tiles sized for individual print sheets. It's also useful for building sprite sheets or breaking a wide banner into social-media-sized crops without doing the math by hand. If you're going the other direction - assembling many images into one grid - look at this pack's lay_ImageGrid or lay_image_grid_note instead; lay_edge_cut is one-image-in, many-images-out.

Installing it

Easiest path: open ComfyUI Manager, search ComfyUI-Apt_Preset, and install. Manually, it's:

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset.git

Then run install.bat (Windows) to pull in the pack's Python dependencies, or install its requirements.txt yourself on Linux/Mac, and restart ComfyUI. lay_edge_cut itself needs no external models or extra dependencies beyond what the base install pulls in - it's pure image manipulation.

Troubleshooting

ComfyUI-Apt_Preset is a genuinely huge pack - it ships loaders, controllers, samplers and a long tail of utility nodes, and packs that size are the ones most likely to trip on a missing dependency after a ComfyUI or Python update. There's at least one reported case on Reddit of the whole pack failing to import (IMPORT FAILED: ...ComfyUI-Apt_Preset) while a user was troubleshooting an unrelated node - if that happens to you, check the ComfyUI console output right above the failure for the specific missing package, and re-run install.bat (or pip install -r requirements.txt) rather than assuming the pack itself is broken.

Beyond that, the failure modes here are ordinary ones: if the grid looks lopsided, remember rows/cols don't have to divide the image evenly, so the last row or column of tiles can end up a different size than the rest - that's expected, not a bug. And if auto_crop_edge is cropping more than you want, turn it off and use trim_border alone for predictable, fixed-margin cuts instead.

CategoryApt_Preset/imgEffect

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
rowsINT21–10
colsINT31–10
auto_crop_edgeBOOLEANfalse
trim_borderINT00–100

Outputs (2)

NameTypeDescription
previewIMAGE
split_imageIMAGE