ComfyUI Node

SpriteSheetMaker

Turn a folder of images into a sprite sheet without leaving ComfyUI

By OSAnimate·Created 2 years ago·Updated 2 years ago· 9
SpriteSheetMaker
    • sprite_image
    images_directory
    row_count2
    column_count2

    SpriteSheetMaker is exactly what the name says and nothing more: it reads every image from a folder inside ComfyUI's input directory, stitches them into a row-by-column grid, and hands you one combined IMAGE tensor. No API calls, no model downloads, no hidden AI magic - the whole node is a few dozen lines of Python that paste images onto a blank canvas. That sounds trivial until you actually need a contact sheet of character poses, a frame grid to eyeball before animating, or a single texture you can drop straight into a game engine. If you've ever manually stitched four images together in an image editor, this kills that step.

    It's a genuinely thin utility, so treat it accordingly: reach for it when you want a grid inside the graph - feed the output to a preview, a save node, or a conditioning pipeline - rather than as a post-processing tool you run by hand.

    How it works

    Drop images into a subfolder of ComfyUI/input (for example ComfyUI/input/my_sprites/), pick that folder in the dropdown, set rows and columns, and run. The node opens every .png, .jpg, .jpeg, .gif, .bmp, and .tiff it finds, builds a grid where each cell is the size of the largest image, and pastes them in row-major order - top-left to bottom-right, then wrapping down. The output is a standard float tensor in [1, H, W, 3] RGB form, so it plugs into anything that takes an IMAGE.

    The author's own note, buried in the example workflow, is the part that trips everyone up: you must put images in a folder inside ComfyUI/input, then restart ComfyUI so the dropdown picks it up. The dropdown only lists subfolders - it won't show loose files sitting in the input root, and it won't refresh mid-session.

    The three inputs, and the trap

    Only three inputs exist, and two of them are just grid dimensions:

    • images_directory - a dropdown of folders inside ComfyUI/input. This is the one you actually work with.
    • row_count (default 2) and column_count (default 2) - the grid shape. Total cells = rows × columns, so 3×3 holds nine images.

    Now the trap, because the code is quietly unforgiving: every image must be the same pixel size, or the node raises a ValueError and aborts. There's no resizing, no letterboxing on output - smaller images get centered in their cell, but mismatched dimensions are a hard stop. Normalize your images to one resolution before they hit the folder (run them through an Upscale/resize node and save, or crop in an editor). Two more silent gotchas from the source: if you have more images than grid cells, the extras are silently dropped - no warning - and if you have fewer, the leftover cells stay black. And image order comes from os.listdir, which is not filename-sorted, so if order matters, rename your files with zero-padded prefixes like 001.png, 002.png and test before you trust the layout.

    Install

    No heavy dependencies - the code only uses PIL, numpy, and torch, all of which ComfyUI already ships. The README's way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/OSAnimate/ComfyUI-SpriteSheetMaker.git
    

    Then restart ComfyUI. Or, since this one is published to the Comfy Registry under publisher osanimate, you can install it through ComfyUI Manager by searching "ComfyUI-SpriteSheetMaker" - same result, fewer keystrokes. There's no requirements.txt to fight with, which is refreshing in an ecosystem where custom nodes are the main source of dependency headaches.

    Common issues

    • "No image files found" - the folder is empty, the files aren't one of the supported extensions, or you pointed at a folder that isn't a subfolder of input.
    • "Size mismatch" - the big one. All images must match the first one's dimensions exactly. Normalize first.
    • Folder missing from the dropdown - create the folder before restarting ComfyUI; the list is built at load time.
    • Wrong layout - remember it's rows first: row_count 3, column_count 3 fills left-to-right, three rows deep. Extras vanish silently, so count your files against rows × columns before you run.

    It won't sort, it won't resize, and it won't tell you when it dropped frames. Accept those limits and it's a clean little tool that just works - the kind of node you'll forget is installed until the day it saves you twenty minutes.

    CategoryImageGrid

    Inputs (3)

    NameTypeDefaultDescription
    images_directoryCOMBO1 options: 3d
    row_countINT2
    column_countINT2

    Outputs (1)

    NameTypeDescription
    sprite_imageIMAGE