Background Removal

This model removes the background image from any image


API

If you're looking for an API, you can choose from your desired programming language.

POST
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 27 28 import requests import base64 # Use this function to convert an image file from the filesystem to base64 def image_file_to_base64(image_path): with open(image_path, 'rb') as f: image_data = f.read() return base64.b64encode(image_data).decode('utf-8') # Use this function to fetch an image from a URL and convert it to base64 def image_url_to_base64(image_url): response = requests.get(image_url) image_data = response.content return base64.b64encode(image_data).decode('utf-8') api_key = "YOUR_API_KEY" url = "https://api.segmind.com/v1/bg-removal" # Request payload data = { "image": image_url_to_base64("https://www.segmind.com/bg-removal.jpg"), # Or use image_file_to_base64("IMAGE_PATH") "method": "object" } headers = {'x-api-key': api_key} response = requests.post(url, json=data, headers=headers) print(response.content) # The response is the generated image
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.