Image Editing v2 (Plus plan)
Production server (Plus plan)
Production server (Plus plan)
POST
/v2/edit
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://image-api.photoroom.com/v2/edit' \
--header 'x-api-key;'
响应示例响应示例
200 - 示例 1
{}
请求参数
Header 参数
x-api-key
string
必需
Body 参数multipart/form-data
background.color
string
可选
background.imageUrl
or background.imageFile
is provided.Can be a hex color without the hash sign (example:
FF0000
, FFF
, FF0000EE
) or color name (examples: red
, blue
)removeBackground
is set to false
background.imageFile
file
可选
background.imageUrl
to provide an image for the background.removeBackground
is set to false
background.imageUrl
is provided, neither background.imageFile
nor background.prompt
can be provided, and vice versa.background.negativePrompt
string
可选
If provided, the generation algorithm will try to avoid properties listed in the negativePrompt.
background.prompt
string
可选
background.scaling
string
可选
If set to
fit
, the empty pixels will be transparentbackground.imageUrl
or background.imageFile
is providedbackground.seed
number
可选
export.format
string
可选
horizontalAlignment
string
可选
ignorePaddingAndSnapOnCroppedSides
to false
for the horizontal direction.ignorePaddingAndSnapOnCroppedSides
boolean
可选
true
(default), cropped sides of the subject will snap to the edgesFor instance, for a portrait image cropped below the elbows, the subject will be aligned at the bottom
even if a bottom padding is provided (but it will still respect bottom margin)
removeBackground
is set to false
imageFile
file
可选
imageFile
only.imageUrl
.lighting.mode
string
可选
If set to
ai.auto
, the lighting will be automatically adjustedmargin
number
可选
Unlike
padding
, margin is never ignored even on cropped sides of the subject.(See positioning section of the documentation for more information)
marginBottom
number
可选
marginLeft
number
可选
marginRight
number
可选
marginTop
number
可选
maxHeight
number
可选
outputSize
is originalImage
or croppedSubject
.Useful for: redimensioning while keeping the aspect ratio
maxWidth
number
可选
outputSize
is originalImage
or croppedSubject
.Useful for: resizing an image while keeping the aspect ratio
outputSize
string
可选
widthxheight
for a custom size (example: 200x400
)originalImage
to keep the original image dimensionscroppedSubject
to use the size of the foreground dimensions after cropping around itpadding
number
可选
margin
, it will be ignored on cropped sides of the subject if the option is enabledExpressed in a ratio of the size of the document, minus margins (similar to CSS)
(See positioning section of the documentation for more information)
paddingBottom
number
可选
paddingLeft
number
可选
paddingRight
number
可选
paddingTop
number
可选
referenceBox
string
可选
subjectBox
by default. When set to originalImage
, the padding / margin will be around the original imageand not the cropped subject.
of a landscape image and outputSize is a square.
removeBackground
is set to false
removeBackground
boolean
可选
scaling
string
可选
If set to
fit
, the empty pixels will be transparentimageUrl
or imageFile
is providedshadow.mode
string
可选
If set to
ai.soft
, a soft shadow will be generatedIf set to
ai.hard
, a hard shadow will be generatedIf set to
ai.floating
, a floating shadow will be generatedtextRemoval.mode
string
可选
ai.artificial
, artificial text will be automatically removed.Artificial text includes all text added on an image through post-precessing, such as company name, watermarks, discount, etc.
ai.natural
, natural text will be automatically removed.Natural text includes text that naturally occurs in an image such as writing on buildings or clothings, road signs, etc.
ai.all
, all text (natural and artificial) will be automatically removed.verticalAlignment
string
可选
ignorePaddingAndSnapOnCroppedSides
to false
for the vertical direction.返回响应
修改于 2024-04-17 06:52:37