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.
GET https://comfy.org/workflows/download/2e37304a2fbd.jsonFetching workflow JSON…
Run it from Python or TypeScript with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
# Install (beta)
pip install comfy-sdk # Python
npm i @comfyorg/sdk # TypeScript
# Run this workflow (Python)
from comfy_sdk import Comfy
client = Comfy(api_key="comfyui-...")
wf = client.workflows.from_file("workflow_api.json")
job = client.run(wf)
for output in job.get_outputs("<output-node-id>"):
output.to_file(output.name)The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API). API access requires a Comfy Cloud plan with an API key. SDK docs · Get an API key
FAQ














