Expand Image is a guided outpainting workflow that grows a single photo to any target aspect ratio without cropping or distorting the original pixels. It wraps your image in a flat green matte to reach the new canvas size, then uses Qwen Image Edit 2511 to replace only the green area with believable scene continuation. Core utility nodes—GetImageSize, ImageResizeKJv2, CustomCombo, and ComfyNumberConvert—calculate the new dimensions and margins so the source stays centered and untouched while the surrounding frame becomes the editable region.
To keep the new content on-style and on-topic, the workflow can automatically write a scene-continuation caption for the missing region using TextGenerateLTX2Prompt and a local VLM backend (configured by you), then JsonExtractString parses the result. A ComfySwitchNode lets you flip between that auto caption and a manual description you type in PrimitiveStringMultiline. The final instruction is assembled with StringConcatenate and, together with CLIPLoader (for text conditioning when required), guides Qwen Image Edit 2511 to synthesize lighting, materials, and perspective that match the visible photo. PreviewAny and ImageCompare help you evaluate changes, and SaveImageAdvanced stores the outpainted result and metadata for reproducibility.
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/f8cf4feac2e9.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














