This ComfyUI workflow outpaints a single image to any target aspect ratio without cropping or distorting your original. You load an image with LoadImage, then the custom Image Extender node (b26cc822-68bf-4fd0-b66f-bb3f99cd1443) builds a new canvas based on your chosen aspect ratio and anchors the original at a user-defined position (in percent). Only the newly added canvas area is generated—your original pixels remain intact. Under the hood, the Image Extender wraps the diffusion process using the Nano Banana Pro model to synthesize surrounding content that blends naturally with the source.

Supporting nodes make the process clear and repeatable: GetImageSize reads the source dimensions, ImageResizeKJv2 optionally scales inputs or outputs for cleaner detail, and PreviewImage/ImageCompare help you evaluate before/after results. If you prefer guided generation, GeminiImage2Node can provide an image-aware prompt that feeds into the Image Extender. When you’re satisfied, SaveImage writes the final outpainted result. The combination of precise placement controls, aspect ratio targeting, and a capable outpainting model makes this a practical tool for repurposing images for social, web, and print formats without losing key content.

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.

2e37304a2fbd.json
Fetching workflow JSON…

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 this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";

const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");

The 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

Frequently Asked Questions

View all workflows
Showing 30 of 30 templates