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

# 画像を編集

> <ul><li>元画像とプロンプトから編集画像または拡張画像を作成します。</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/images/edits' \
    --header 'Authorization: Bearer <token>' \
    --form 'image=@https://example.com/image.png' \
    --form 'mask=@file.bin' \
    --form 'prompt=日差しのある庭を走る小さな子猫、映画的、高精細' \
    --form 'n=1' \
    --form 'size=1024x1024' \
    --form 'response_format=json' \
    --form 'user=' \
    --form 'model=gpt-image-1.5'
  ```

  ```python Python theme={null} theme={null}
  import requests

  url = "https://api.elkapi.com/v1/images/edits"
  headers = {
      "Authorization": "Bearer <token>"
  }
  files = {
      "image": open("https://example.com/image.png", "rb"),
      "mask": open("file.bin", "rb"),
  }
  data = {
      "prompt": "日差しのある庭を走る小さな子猫、映画的、高精細",
      "n": "1",
      "size": "1024x1024",
      "response_format": "json",
      "user": "",
      "model": "gpt-image-1.5",
  }

  response = requests.request("POST", url, headers=headers, data=data, files=files)
  print(response.text)
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/v1/images/edits";

  const headers = {
    "Authorization": "Bearer <token>"
  };
  const form = new FormData();
  form.append("image", fileInput.files[0]);
  form.append("mask", fileInput.files[0]);
  form.append("prompt", "日差しのある庭を走る小さな子猫、映画的、高精細");
  form.append("n", "1");
  form.append("size", "1024x1024");
  form.append("response_format", "json");
  form.append("user", "");
  form.append("model", "gpt-image-1.5");

  const response = await fetch(url, {
    method: "POST",
    headers,
    body: form
  });

  console.log(await response.text());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {}
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  すべてのエンドポイントで Bearer Token 認証が必要です。

  リクエストヘッダーに追加します:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="image" type="file" required>
  編集する画像。有効なPNGファイルで、4MB未満、正方形である必要があります。マスクを指定しない場合、画像には透明度が必要で、その透明部分がマスクとして使用されます。

  例:`cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png`
</ParamField>

<ParamField body="mask" type="file">
  追加画像です。完全に透明な領域（例: alpha が0の領域）が、image を編集する位置を示します。有効なPNGファイルで、4MB未満、元のimageと同じ寸法である必要があります。

  例:\`\`
</ParamField>

<ParamField body="prompt" type="string" required>
  生成したい画像のテキスト説明。最大長は1000文字です。

  例:`A cute baby sea otter wearing a beret.`
</ParamField>

<ParamField body="n" type="string">
  生成する画像数。1〜10の範囲で指定します。

  例:`1`
</ParamField>

<ParamField body="size" type="string">
  生成画像のサイズ。`256x256`、`512x512`、`1024x1024` のいずれかである必要があります。

  例:`1024x1024`
</ParamField>

<ParamField body="response_format" type="string">
  生成画像の返却形式。`url` または `b64_json` である必要があります。

  例:`url`
</ParamField>

<ParamField body="user" type="string">
  エンドユーザーを表す一意の識別子です。OpenAI が不正利用を監視・検出するのに役立ちます。[詳細](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids)。

  例:\`\`
</ParamField>

<ParamField body="model" type="string" default="gpt-image-1.5">
  例:`gpt-image-1.5`
</ParamField>

## Response
