This ComfyUI workflow is designed to seamlessly combine four separate images into a cohesive 2x2 grid, outputting a single image with a resolution of 2048x2048 pixels. The workflow employs several key nodes to ensure each image fits perfectly within the grid, even if the input images vary in size. The `LoadImage` nodes are used to bring in the individual images, which are then processed through the `ResizeImageMaskNode` to standardize their dimensions. This resizing step is crucial for maintaining the grid's uniformity and ensuring each image aligns correctly. The `ImageStitch` nodes are the core of this workflow, first joining the top-left and top-right images into a single row, and then the bottom-left and bottom-right images into another row. Finally, a third `ImageStitch` node stacks these two rows vertically to complete the grid. The resulting image is saved using the `SaveImage` node. This workflow is particularly useful for creating composite images for presentations, social media posts, or any application where a unified image layout is desired.
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run "Image Stitch 2x2 Grid" (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
// This workflow, exported in API format (see note below)
const wf = await client.workflows.fromFile("utility_image_stitch_api.json");
const asset = client.assets.fromFile("input.png");
wf.setInput("12", "image", asset); // LoadImage
const job = await client.run(wf);
await job.getOutputs("19")[0].toFile("output.png"); // SaveImageThe SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
FAQ














