Nodes/ComfyUI-AharaNodes/Frame Segmenter
ComfyUI Node

Frame Segmenter

Split your frame into a grid, and get the seam mask to hide the joins

By chris-arsenault·Created 2 years ago·Updated 2 years ago· 0
Frame Segmenter
    • frame_segments
    • seam_mask
    row_count2
    col_count_12
    col_count_22
    col_count_32
    seam_width30
    frames1
    frame_width512
    frame_height512

    Frame Segmenter is the geometry half of this pack's "generate a frame in pieces" idea. It takes a target frame size, cuts it into a grid - up to three rows, each with its own column count - and hands you two things: the grid itself as a FRAME_SEGMENTS object, and a seam_mask that draws a band of white along every internal boundary between cells.

    Why cut a frame into pieces at all? Two workflows, both well-trodden in the ecosystem. First, regional prompting: when a single prompt with two subjects bleeds their attributes together - the classic "the girl on the left keeps stealing the red hair" problem - you generate each cell with its own prompt and composite the results. Second, tiled detail work: sample each cell at higher effective resolution, the "tile and conquer" pattern from tiled-diffusion upscaling, then stitch the cells back together. The seam mask is the part most grid nodes skip, and it's the difference between "looks like one image" and "looks like four tiles."

    The inputs:

    • row_count (1–3) and col_count_1 / col_count_2 / col_count_3: the grid. Each row has its own column count, so irregular layouts are allowed - the author's "modes" (3x3, 3x2, 3x1, 3x1+1x1) are just combinations of these.
    • seam_width (1–100, default 30): how wide the overlap bands on the seam mask are. Must be even.
    • frames (1–4096): the mask is batched out to one copy per frame, so the whole thing works for video without extra wiring.
    • frame_width / frame_height: the canvas you're dividing.

    Outputs: frame_segments (the FRAME_SEGMENTS object, consumed only by this pack's Get Frame at Index node) and seam_mask (a MASK, white boundary bands on black).

    Mechanically it's pure math plus a bit of PIL drawing - no diffusion, no model, instant. It computes each cell's rectangle and paints seam-width rectangles on every internal edge, skipping the outer borders of the frame.

    The trap is validation. The frame must divide evenly: frame_height has to be a multiple of row_count, frame_width a multiple of every column count you actually use, and seam_width even. If any check fails, the node logs a message and returns False where a MASK and FRAME_SEGMENTS are expected - which shows up as a confusing downstream type error. So 768×512 with 3 rows is a fail (512 isn't divisible by 3). Pick dimensions that divide cleanly: 512×512 into a 2×2 grid gives 256×256 cells.

    Install

    Same for every node in this pack. ComfyUI Manager → Custom Nodes → search "ComfyUI-AharaNodes" → Install → restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chris-arsenault/ComfyUI-AharaNodes
    # then restart ComfyUI
    

    No requirements.txt, no model files. Registered with the Comfy Registry.

    Troubleshooting

    Your immediate "it broke" is almost always the divisibility check above - check the ComfyUI console log for the "not a multiple of" messages. And expect visible seams if you composite naively; that's exactly what the seam mask exists to blend away.

    CategoryAharaNodes/frame_segmenter

    Inputs (8)

    NameTypeDefaultDescription
    row_countINT21–3
    col_count_1INT21–3
    col_count_2INT21–3
    col_count_3INT21–3
    seam_widthINT301–100
    framesINT11–4096
    frame_widthINT51216–4096
    frame_heightINT51216–4096

    Outputs (2)

    NameTypeDescription
    frame_segmentsFRAME_SEGMENTS
    seam_maskMASK