Nodes/Arc2Face ComfyUI Node Library/Arc2Face Image Grid Generator
ComfyUI Node

Arc2Face Image Grid Generator

Feed Arc2Face a whole folder of faces at once

By caleboleary·Created 2 years ago·Updated 2 years ago· 53
Arc2Face Image Grid Generator
    • IMAGE
    directory
    max_images16
    max_size768

    The Arc2Face Face Extractor does its best work when you give it multiple photos of a person - several faces tends to beat a single one, per the pack's own README. But dragging eight images into ComfyUI and stitching them into one batch is fiddly. The Arc2Face Image Grid Generator is the pack's answer: point it at a folder, and it tiles everything into a single grid image you can feed straight into the Face Extractor.

    It's pure glue, and it's honest about it - it has the fewest impressions of any node in the pack on comfy.icu, and that's fair. It's not a model, not a technique, just a time-saver. But it's a good one for the multi-reference workflow.

    Mechanically it's unglamorous: it lists the directory, filters for .png/.jpg/.jpeg/.bmp/.gif, takes the first max_images files, resizes each so its long edge fits within max_size (LANCZOS), then pastes them into a square-ish grid where the column count is the ceiling of the square root of the image count. One IMAGE tensor out.

    Inputs

    • directory - a plain text path. There's no file browser; you type it. Can be an absolute path or relative to ComfyUI's working directory.
    • max_images - 16 default, up to 64. A hard cap on how many photos get tiled.
    • max_size - 768 default. The cell size; each photo is scaled so its longest edge fits this.

    Output

    IMAGE - one grid image, which you wire into the Arc2Face Face Extractor's images input. From there the extractor detects every face in every cell and averages them into a single embedding. That's the whole flow: folder → grid → extractor → generator.

    Real-world notes

    • Files are taken in whatever order the OS returns them, and max_images is a cap, not a curated pick. So treat the folder as the selection: dump only the shots you actually want in there, or you'll find a stray screenshot squeezing out a good reference photo.
    • Non-square images leave blank space in their cell. Each photo is scaled to fit the max_size square, so a tall portrait pasted into a square cell leaves empty space beside it. Harmless for the face detector - it just finds faces in the photo part.
    • Empty folder = hard error. Give it at least one image.
    • You can absolutely replace this node with a standard Load Images node feeding a batch, but the grid node exists so you can swap in a folder of references without touching the graph.

    Install

    Same as the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/caleboleary/ComfyUI-Arc2Face.git
    pip install -r requirements.txt
    

    No extra model downloads for this one - it's pure image handling. The heavy lift (InsightFace ONNX files, the Arc2Face checkpoint) belongs to the extractor and loaders it feeds.

    CategoryArc2Face

    Inputs (3)

    NameTypeDefaultDescription
    directorySTRING
    max_imagesINT161–64
    max_sizeINT76864–2048

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE