Photoroom
    Photoroom
    • Remove Background (Basic plan)
      POST
    • Account Details
      GET
    • Image Editing v2 (Plus plan)
      GET
    • Image Editing v2 (Plus plan)
      POST
    • [LEGACY] Image Editing v1 (Plus plan)
      GET
    • [LEGACY] Image Editing v1 (Plus plan)
      POST

      Remove Background (Basic plan)

      Production server (Plus plan)
      https://image-api.photoroom.com
      Production server (Plus plan)
      https://image-api.photoroom.com
      POST
      /v1/segment
      Remove background from an image
      请求示例请求示例
      Shell
      JavaScript
      Java
      Swift
      curl --location --request POST 'https://image-api.photoroom.com/v1/segment' \
      --header 'x-api-key;'
      响应示例响应示例
      200 - 示例 1
      {
        "base64img": "string"
      }

      请求参数

      Header 参数
      x-api-key
      string 
      必需
      Body 参数multipart/form-data
      image_file
      file 
      可选
      The image file to render
      format
      enum<string> 
      Format
      可选
      The format of the resulting image
      枚举值:
      pngjpgwebp
      默认值:
      png
      示例值:
      png
      channels
      enum<string> 
      Channels
      可选
      The channels of the resulting image
      枚举值:
      rgbaalpha
      默认值:
      rgba
      示例值:
      rgba
      bg_color
      string 
      Background Color
      可选
      The background color of the resulting image. Can be a hex code (#FF00FF) or a HTML color (red, green, etc.)
      size
      enum<string> 
      Size
      可选
      Will resize the output to the specified size. Can be preview (0.25 Megapixels), medium (1.5 MP), hd (4 MP) or full (36 MP, can be slower for large images). Useful for mobile apps that need smaller images.
      枚举值:
      previewmediumhdfull
      默认值:
      full
      示例值:
      full
      crop
      enum<string> 
      Crop
      可选
      If true, the image returned is cropped to the cutout border. Transparent pixels are removed from the border
      枚举值:
      truefalse
      默认值:
      false
      示例值:
      false

      返回响应

      🟢200OK
      application/json
      Body
      base64img
      string <base64>
      Base64 encoded image
      必需
      🟠400Bad Request
      🟠402Payment Required
      下一页
      Account Details
      Built with