Image upscaling improves the resolution and visual quality of an existing image. Send a base64-encoded image to /image/upscale, choose a scale factor, and Venice returns the enhanced image as binary data.
Use image upscaling when you already have an image and want a higher-resolution output. Use image generation when you need to create an image from a prompt, and image editing when you need to change image content.
Basic Usage
import base64
import os
from pathlib import Path
import requests
image_base64 = base64.b64encode(Path("input.jpg").read_bytes()).decode("utf-8")
response = requests.post(
"https://api.venice.ai/api/v1/image/upscale",
headers={
"Authorization": f"Bearer {os.environ['VENICE_API_KEY']}",
"Content-Type": "application/json",
},
json={
"image": image_base64,
"scale": 2,
},
)
response.raise_for_status()
Path("upscaled.png").write_bytes(response.content)
import { readFile, writeFile } from "node:fs/promises";
const image = await readFile("input.jpg");
const response = await fetch("https://api.venice.ai/api/v1/image/upscale", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VENICE_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
image: image.toString("base64"),
scale: 2,
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
const output = Buffer.from(await response.arrayBuffer());
await writeFile("upscaled.png", output);
IMAGE_BASE64=$(base64 < input.jpg | tr -d '\n')
curl https://api.venice.ai/api/v1/image/upscale \
-H "Authorization: Bearer $VENICE_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"image\": \"$IMAGE_BASE64\",
\"scale\": 2
}" \
--output upscaled.png
Parameters
| Parameter | Type | Required | Description |
|---|
image | string | Yes | Base64-encoded source image. |
scale | number | No | Upscale factor. Use the supported values listed by the API reference and model catalog. |
The response is binary image data, not JSON. Write the response body directly to a file or stream it to storage.
- Start with the cleanest source image you have. Upscaling improves detail, but it cannot fully recover information that is not present.
- Use moderate scale factors for production workflows. Very large outputs can increase latency and file size.
- Keep the original image around if you need to compare quality or retry with different settings.