Skip to main content

Image Editing

Edit, upscale, and create variations of existing images using AgentOS provider-agnostic APIs.

Quick Start

CLI

# Edit an image with a text prompt
wunderland image edit ./photo.jpg --prompt "Make it a sunset scene" --output edited.png

# Upscale an image 4x
wunderland image upscale ./thumbnail.jpg --scale 4 --output upscaled.png

# Create 3 variations
wunderland image variate ./photo.jpg --n 3 --output variations/

Programmatic

import { editImage, upscaleImage, variateImage } from '@framers/agentos';

// Img2img / style transfer
const edited = await editImage({
image: imageBuffer,
prompt: 'Oil painting in impressionist style',
strength: 0.65,
});

// Upscale
const upscaled = await upscaleImage({
image: imageBuffer,
scale: 4,
});

// Variations
const variations = await variateImage({
image: imageBuffer,
n: 3,
});

Three APIs

APIPurposeProviders
editImage()Img2img, inpainting, outpaintingOpenAI, Stability, Replicate, Local SD
upscaleImage()2x/4x super resolutionStability, Replicate, Local SD
variateImage()Create N variationsOpenAI, Stability, Replicate

Inpainting

Provide a mask image where white pixels mark the area to regenerate:

const result = await editImage({
image: roomPhoto,
mask: maskBuffer, // White = edit area, black = preserve
prompt: 'A large bookshelf filled with colorful books',
strength: 0.9,
});

Strength Parameter

RangeBehavior
0.0–0.3Subtle adjustments (color grading, minor touch-ups)
0.4–0.6Moderate changes (style transfer, lighting)
0.7–1.0Major transformation (content regenerated, composition preserved)

Provider Setup

ProviderEnv VarCost
OpenAIOPENAI_API_KEY$$$
Stability AISTABILITY_API_KEY$$
ReplicateREPLICATE_API_TOKEN$$
Local SD (A1111/ComfyUI)STABLE_DIFFUSION_LOCAL_BASE_URLFree

Local Stable Diffusion

# A1111
export STABLE_DIFFUSION_LOCAL_BASE_URL=http://localhost:7860

# ComfyUI
export STABLE_DIFFUSION_LOCAL_BASE_URL=http://localhost:8188
export STABLE_DIFFUSION_LOCAL_BACKEND=comfyui

Further Reading