Comfyui-Kling-Wrapper Image Expander
Stretch an image in any direction
- image
- image
Outpainting - extending an image beyond its edges - is a job most people do locally with inpainting models and a lot of masking. Image Expander is the API shortcut: you give it an image and four ratios, and Kling extends each edge with generated content that matches. No masks, no inpaint passes, one call.
It's the node you reach for when a generated image is framed too tight. Portrait shot cropped at the shoulders and you want the full torso? Expand down. Product photo that needs breathing room on both sides for a layout? Expand left and right. The four ratio sliders make it feel like a crop tool running backwards.
The inputs
image- the source image, a plainIMAGEconnection.up_expansion_ratio/down_expansion_ratio/left_expansion_ratio/right_expansion_ratio- each 0–2, default 0. These are the amounts of new content to add on each edge. 1.0 roughly doubles the image along that axis; 0.5 adds half again. You can expand one side only or all four - they're independent.
Optional:
prompt- describes what should appear in the expanded regions. Leave it empty and Kling invents plausible continuation; give it a hint ("continue the brick wall") for more controlled results. For seamless-looking outpaint, describing the scene is often the difference between "extended" and "extended believably."image_num- how many variants to generate, 0–9, default 1. More variants means more API spend but a better chance to pick a winner.
Output
One output: image - the expanded image (or images, batched if image_num > 1), returned as a standard IMAGE tensor. From there it feeds anywhere in your graph: Save Image, Image2Video, whatever.
Install and gotchas
Standard pack install: ComfyUI Manager (search "Comfyui-Kling-Wrapper") or git clone https://github.com/magicwang1111/Comfyui-Kling-Wrapper.git into custom_nodes, pip install -r requirements.txt, restart, Kling API key in config.local.json. API node - no local model, metered credits.
The practical gotcha is asymmetry in cost, not just in control. Expanding all four edges in one run is a single call, but each expansion ratio increases the rendered area, and the API bills on output size. Huge total expansions (like 2.0 on every side) get expensive fast. Also: the expansion direction matters for realism. Extending a sky upward usually looks seamless; extending a face's edges by 2x usually doesn't. Kling handles texture continuation well but semantic continuation ("what should be over there") is where a good prompt saves the run.
And one honest limitation: this node's output is a static image, not video. If your real goal is "pan out to reveal more," you might be better served generating the wide video directly with Multi Images To Video using the expanded image as the destination frame. But for layout, composition, and framing work, Image Expander is the fastest outpainting tool in the pack - no mask workflow to learn.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| up_expansion_ratio | FLOAT | 0.000–2 | — |
| down_expansion_ratio | FLOAT | 0.000–2 | — |
| left_expansion_ratio | FLOAT | 0.000–2 | — |
| right_expansion_ratio | FLOAT | 0.000–2 | — |
| promptopt | STRING | — | |
| image_numopt | INT | 10–9 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |