# SD图生图 - 换背景接口
<a id=SD图生图 - 换背景接口>
# 基本信息
Path: /pictures/change_background
Method: POST
接口描述:
SD图生图接口-618图片背景替换项目-YApi-高效、易用、功能强大的可视化接口管理平台 (smzdm.com)
{
"img_url":"http://qneimg.smzdm.com/202407/15/6694883826b1a866.png",
"mask_url":"http://qneimg.smzdm.com/202407/15/66948855aeb9e8873.png",
"prompt":"light green theme, no humans, toilet, indoors, washing machine, solo, toilet paper, still life, green background, circular platform, best quality, 8k, masterpiece, best detail",
"negative_prompt":"wrinkles, watermark,male,masculinity,bad and mutated hands, oiliness, NSFW, worst quality, low quality, horror, geometry, white border, signature,red cloth background, hand, the background of folds, grayscale, monochrome, bad body, deformed,mutated hands,extra hands",
"sd_model_checkpoint":"majicmixRealistic_v7.safetensors",
"sd_lora_name":["simple_bg_0811-006400.safetensors"],
"sd_lora_weight": [0.8],
"upload_img_config": {"channel":1202,"type":"public"},
"batch_size":1,
"api_type":"comfyui"
}
{
"img_url": "http://qneimg.smzdm.com/202410/30/6721f62cd96ac9476.png",
"mask_url": "https://qneimg.smzdm.com/202409/20/66ece4b7132c61948.png",
"prompt": "Beige theme, 3D scene, product photography, no people, laptop, solo, still life, solid color background, clean and simple background, bright colors, beige background, minimalist style, center circular platform, best quality, 8k, masterpiece, best details",
"negative_prompt": "wrinkles, watermark,male,masculinity,bad and mutated hands, oiliness, NSFW, worst quality, low quality, horror, geometry, white border, signature,red cloth background, hand, the background of folds, grayscale, monochrome, bad body, deformed,mutated hands,extra hands",
"sd_model_checkpoint": "epicphotogasm_ultimateFidelity.safetensors",
"sd_lora_name":["simple_bg_0911-004000.safetensors"],
"sd_lora_weight": [0.8],
"upload_img_config": {"channel": 1202, "type": "public", "public_host":1},
"batch_size": 2,
"steps": 25,
"api_type": "comfyui",
"is_controlnet": 1,
"control_model": "control_v11p_sd15_lineart.pth"
}
# 请求参数
Headers
参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
---|---|---|---|---|
Content-Type | application/json | 是 |
Body
| 名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
| -------------------- | -------- | -------- | ------ | -------------------------------------------------------------------- | ----------------------------------------- |
| callback_url | string | 非必须 | | 回调URL | |
| taskid | number | 非必须 | | 任务ID # 默认值 -1 不回调 | |
| prompt | string | 必须 | | 提示词 | |
| img_url | string | 必须 | | 图片URL | |
| is_remove_bg | string | 非必须 | | 是否去除背景,默认值True去背景 "True"需要去除,"False"不需要去除 | |
| width | number | 非必须 | | 默认值0 ,保持原图宽度 | |
| height | number | 非必须 | | 默认值0 ,保持原图高度 | |
| negative_prompt | string | 非必须 | | 负面提示词,有默认负面提示词 | |
| is_controlnet | string | 非必须 | | 是否开启controlnet,默认已开启"True" | |
| control_model | string | 非必须 | | controlnet的model名称 | |
| batch_size | string | 非必须 | | 生成图片张数,默认值1张 | |
| mast_expend_num | string | 非必须 | | 生成Mast的膨胀系数,默认值-2(调研最优解) | |
| sd_model_checkpoint | string | 非必须 | | 模型名称 | |
| mask_url | string | 非必须 | | img_url对应的mask_url | |
| sd_lora_name | string | 必须 | | Lora列表,如["SDS_DSZGSNBJ_v1.safetensors"] | |
| sd_lora_weight | string | 必须 | | Lora权重列表,如[1] | |
| api_type | string | 必须 | | 底层服务类型,默认 pipeline,支持 pipeline 和 comfyui | |
| from | string | 必须 | | 业务来源,跟付飞确认 | |
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 返回数据
# 返回数据
名称 | 类型 | 是否必须 | 默认值 | 备注 | 其他信息 |
---|---|---|---|---|---|
error_code | number | 非必须 | |||
error_msg | string | 非必须 | |||
data | string [] | 非必须 | item 类型: string | ||
非必须 |