POST
javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 const axios = require('axios'); const fs = require('fs'); const path = require('path'); async function toB64(imgPath) { const data = fs.readFileSync(path.resolve(imgPath)); return Buffer.from(data).toString('base64'); } const api_key = "YOUR API-KEY"; const url = "https://api.segmind.com/v1/bg-removal"; const data = { "image": "toB64('/bg-removal.jpg')", "method": "object" }; (async function() { try { const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } }); console.log(response.data); } catch (error) { console.error('Error:', error.response.data); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


imageimage *

Input Image


methodenum:string ( default: object )

Method

Allowed values:

To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.

Background Removal

Background removal is a cutting edge model that is designed to instantly remove the background of an image or an object in an image using generative AI. Using Segmind’s free background removal model, you can automatically detect the subject from any image and remove background instantly without any hassle. Harnessing the power of our artificial intelligence tool, it's easy to handle hair, animal fur, or complex edges in just a few seconds.

AI-based background removal, often used in image and video editing software, relies on deep learning models, particularly convolutional neural networks (CNNs), to separate the foreground (the subject) from the background in an image or video.

To use Segmind's background removal model, simply upload an image and click generate, the model will automatically remove the background in seconds. You can then download the image with a transparent background or replace the background with another image or colour.

AI-based background removal is a powerful and versatile technology that is rapidly becoming an essential tool for image and video editors. With Segmind's background removal model, you can easily create high-quality images and videos with professional-looking results.

Background Removal Use Cases

  1. Product photography: Segmind’s background removal tool can be used to create product photos with a white background. This makes the products look more professional and visually appealing.

  2. Portrait editing: The background removal tool can be used to edit portraits by blurring the background or removing it altogether. This can help to make the subject of the portrait stand out more.

  3. Social media graphics: Background removal tool can be used to create social media graphics with interesting and unique backgrounds. This can help to grab attention and make your posts more engaging.

Background Removal License

The Background Removal model is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License. This license allows for the free use, modification, and distribution of the software for non-commercial purposes only, provided that the original copyright notice and disclaimer are included in all copies or substantial portions of the software. However, it does not permit the sharing of adapted material.

The license also does not permit the use of the name of the license holder or the names of its contributors to endorse or promote products derived from this software without specific prior written permission. Furthermore, the license is irrevocable, meaning once granted, it cannot be taken back.