salahzsh/rembg
Remove background from images with specialized models and different techniques. Anime, humans, fast, heavy, silhouettes, etc.
Run salahzsh/rembg with an API
Use one of our client libraries to get started quickly. Clicking on a library will take you to the Playground tab where you can tweak different inputs, see the results, and copy the corresponding code to use in your own project.
Input schema
The fields you can use to run this model with an API. If you don't give a value for a field its default value will be used.
| Field | Type | Default value | Description |
|---|---|---|---|
| image |
string
|
Input image
|
|
| model |
None
|
birefnet-general
|
Model
|
| alpha_matting |
boolean
|
False
|
Use alpha matting for smoother edges
|
| alpha_matting_foreground_threshold |
integer
|
240
Max: 255 |
Foreground threshold for alpha matting
|
| alpha_matting_background_threshold |
integer
|
10
Max: 255 |
Background threshold for alpha matting
|
| alpha_matting_erode_size |
integer
|
10
|
Erosion size for alpha matting
|
| only_mask |
boolean
|
False
|
Return only the binary mask instead of the cutout
|
| post_process_mask |
boolean
|
False
|
Apply post-processing to smooth mask boundaries
|
| bgcolor |
string
|
Background color as hex string or leave empty for transparent
|
{
"type": "object",
"title": "Input",
"required": [
"image"
],
"properties": {
"image": {
"type": "string",
"title": "Image",
"format": "uri",
"x-order": 0,
"description": "Input image"
},
"model": {
"enum": [
"birefnet-general",
"birefnet-general-lite",
"birefnet-portrait",
"birefnet-dis",
"birefnet-hrsod",
"birefnet-cod",
"birefnet-massive",
"isnet-anime",
"dis_custom",
"isnet-general-use",
"sam",
"silueta",
"u2net_cloth_seg",
"u2net_custom",
"u2net_human_seg",
"u2net",
"u2netp",
"bria-rmbg",
"ben_custom"
],
"type": "string",
"title": "model",
"description": "Model",
"default": "birefnet-general",
"x-order": 1
},
"bgcolor": {
"type": "string",
"title": "Bgcolor",
"x-order": 8,
"nullable": true,
"description": "Background color as hex string or leave empty for transparent"
},
"only_mask": {
"type": "boolean",
"title": "Only Mask",
"default": false,
"x-order": 6,
"description": "Return only the binary mask instead of the cutout"
},
"alpha_matting": {
"type": "boolean",
"title": "Alpha Matting",
"default": false,
"x-order": 2,
"description": "Use alpha matting for smoother edges"
},
"post_process_mask": {
"type": "boolean",
"title": "Post Process Mask",
"default": false,
"x-order": 7,
"description": "Apply post-processing to smooth mask boundaries"
},
"alpha_matting_erode_size": {
"type": "integer",
"title": "Alpha Matting Erode Size",
"default": 10,
"minimum": 0,
"x-order": 5,
"description": "Erosion size for alpha matting"
},
"alpha_matting_background_threshold": {
"type": "integer",
"title": "Alpha Matting Background Threshold",
"default": 10,
"maximum": 255,
"minimum": 0,
"x-order": 4,
"description": "Background threshold for alpha matting"
},
"alpha_matting_foreground_threshold": {
"type": "integer",
"title": "Alpha Matting Foreground Threshold",
"default": 240,
"maximum": 255,
"minimum": 0,
"x-order": 3,
"description": "Foreground threshold for alpha matting"
}
}
}
Output schema
The shape of the response you’ll get when you run this model with an API.
{
"type": "string",
"title": "Output",
"format": "uri"
}