> ## Documentation Index
> Fetch the complete documentation index at: https://docs.venice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Upscaling

> Enhance and upscale images with Venice's synchronous image upscale API using base64 input and binary image output.

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](/guides/media/image-generation) when you need to create an image from a prompt, and [image editing](/guides/media/image-editing) when you need to change image content.

## Basic Usage

<CodeGroup>
  ```python Python theme={"system"}
  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)
  ```

  ```javascript Node.js theme={"system"}
  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);
  ```

  ```bash cURL theme={"system"}
  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
  ```
</CodeGroup>

## 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. |

<Note>
  The response is binary image data, not JSON. Write the response body directly to a file or stream it to storage.
</Note>

## Input Tips

* 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.

## Related Resources

* [Image Upscale API](/api-reference/endpoint/image/upscale)
* [Image Models](/models/image)
* [Image Editing Guide](/guides/media/image-editing)
