This ComfyUI workflow converts vertical videos to horizontal (and vice versa) by outpainting new canvas areas while keeping the original content intact. It uses LoadVideo and GetVideoComponents to pull frames, FPS, and audio, then normalizes frame size with JWImageResizeByShorterSide so the shorter side matches your target resolution. A masking stage—powered by masquerade-nodes-comfyui and a custom utility node (UUID: 7594b5c0-2b90-4aeb-846b-e3eb8fa89f33)—defines where to synthesize new content versus where to preserve the source. The core transformation happens in KlingOmniProEditVideoNode running the Kling O3 model, which content-aware outpaints the added side bands to reach your target aspect. Video Slice lets you process in manageable chunks for stability and VRAM efficiency, and CreateVideo + SaveVideo assemble and write the final file, with optional audio passthrough from GetVideoComponents.
What makes this useful is that you don’t have to crop away important action. Instead, you reframe with horizontal/vertical offsets and extend the scene, maintaining motion continuity and subject integrity. The workflow is organized into groups—Input Video, Video Resize and Extend, and Video Outpaint—and includes an application mode for a simplified UI: set the target aspect, tweak offsets, and run. Note: this pipeline is optimized for 9:16 ↔ 16:9 conversions. For minor aspect changes or square (1:1), the Kling video edit node isn’t recommended; consider basic crop/pad instead.
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 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














