Skip to content

编辑图像 ​

在给定原始图像和提示的情况下创建编辑或扩展图像。

编辑图像 ​

POST /v1/images/edits/

在给定原始图像和提示的情况下创建编辑或扩展图像。

认证 ​

Bearer

请求体 ​

必填:否

multipart/form-data ​

字段必填类型说明
image是string要编辑的图像。必须是有效的 PNG 文件,小于 4MB,并且是方形的。如果未提供遮罩,图像必须具有透明度,将用作遮罩。
Examples: cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png
mask否string附加图像,其完全透明区域(例如,alpha 为零的区域)指示image应编辑的位置。必须是有效的 PNG 文件,小于 4MB,并且尺寸与原始image相同。
Examples:
prompt是string所需图像的文本描述。最大长度为 1000 个字符。
Examples: A cute baby sea otter wearing a beret.
n否string要生成的图像数。必须介于 1 和 10 之间。
Examples: 1
size否string生成图像的大小。必须是256x256、512x512或 1024x1024之一。
Examples: 1024x1024
response_format否string生成的图像返回的格式。必须是url或b64_json。
Examples: url
user否string代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。了解更多。
Examples:
model否stringExamples: dall-e-2
原始 Schema
json
{
  "type": "object",
  "properties": {
    "image": {
      "description": "要编辑的图像。必须是有效的 PNG 文件,小于 4MB,并且是方形的。如果未提供遮罩,图像必须具有透明度,将用作遮罩。",
      "type": "string",
      "format": "binary",
      "examples": [
        "cmMtdXBsb2FkLTE2ODc4MzMzNDc3NTEtMjA=/31225951_59371037e9_small.png"
      ]
    },
    "mask": {
      "description": "附加图像,其完全透明区域(例如,alpha 为零的区域)指示image应编辑的位置。必须是有效的 PNG 文件,小于 4MB,并且尺寸与原始image相同。",
      "type": "string",
      "format": "binary",
      "examples": [
        []
      ]
    },
    "prompt": {
      "description": "所需图像的文本描述。最大长度为 1000 个字符。",
      "type": "string",
      "examples": [
        "A cute baby sea otter wearing a beret."
      ]
    },
    "n": {
      "description": "要生成的图像数。必须介于 1 和 10 之间。",
      "type": "string",
      "examples": [
        "1"
      ]
    },
    "size": {
      "description": "生成图像的大小。必须是`256x256`、`512x512`或 `1024x1024`之一。",
      "type": "string",
      "examples": [
        "1024x1024"
      ]
    },
    "response_format": {
      "description": "生成的图像返回的格式。必须是`url`或`b64_json`。",
      "type": "string",
      "examples": [
        "url"
      ]
    },
    "user": {
      "description": "代表您的最终用户的唯一标识符,可以帮助 OpenAI 监控和检测滥用行为。[了解更多](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids)。",
      "type": "string",
      "examples": [
        ""
      ]
    },
    "model": {
      "type": "string",
      "examples": [
        "dall-e-2"
      ]
    }
  },
  "required": [
    "image",
    "prompt"
  ]
}

响应 ​

200 Response ​

application/json ​

类型:object

原始 Schema
json
{
  "type": "object",
  "properties": {},
  "x-apifox-orders": []
}