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

# 이미지 업스케일링

> base64 입력과 바이너리 이미지 출력을 사용하는 Venice의 동기식 이미지 업스케일 API로 이미지를 향상 및 확대하세요.

이미지 업스케일링은 기존 이미지의 해상도와 시각적 품질을 향상시킵니다. base64로 인코딩된 이미지를 `/image/upscale`로 전송하고 스케일 배수를 선택하면, Venice가 향상된 이미지를 바이너리 데이터로 반환합니다.

이미 이미지를 가지고 있고 더 높은 해상도의 출력을 원할 때 이미지 업스케일링을 사용하세요. 프롬프트로부터 이미지를 생성해야 한다면 [이미지 생성](/guides/media/image-generation)을, 이미지 콘텐츠를 변경해야 한다면 [이미지 편집](/guides/media/image-editing)을 사용하세요.

## 기본 사용법

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

## 매개변수

| 매개변수    | 유형     | 필수 여부 | 설명                                           |
| ------- | ------ | ----- | -------------------------------------------- |
| `image` | string | 예     | base64로 인코딩된 소스 이미지.                         |
| `scale` | number | 아니요   | 업스케일 배수. API 레퍼런스와 모델 카탈로그에 나열된 지원 값을 사용하세요. |

<Note>
  응답은 JSON이 아닌 바이너리 이미지 데이터입니다. 응답 본문을 파일에 직접 쓰거나 스토리지로 스트리밍하세요.
</Note>

## 입력 팁

* 최대한 깨끗한 소스 이미지에서 시작하세요. 업스케일링은 세부 정보를 개선하지만, 원본에 없는 정보를 완전히 복원하지는 못합니다.
* 프로덕션 워크플로에서는 적당한 스케일 배수를 사용하세요. 매우 큰 출력은 지연 시간과 파일 크기를 증가시킬 수 있습니다.
* 품질을 비교하거나 다른 설정으로 재시도해야 할 경우를 대비해 원본 이미지를 보관해 두세요.

## 관련 리소스

* [이미지 업스케일 API](/api-reference/endpoint/image/upscale)
* [이미지 모델](/models/image)
* [이미지 편집 가이드](/guides/media/image-editing)
