Remove Background API

The following code snippet demonstrates the usage of the Remove Background API provided by Picsart. This API allows users to remove the background from an image using a simple HTTP request. By specifying the desired output type, format, and providing the URL of the image, you can retrieve a cutout version of the image with the background removed.

Remove background from an image

curl -X 'POST' \
  '' \
  -H 'accept: application/json' \
  -H 'x-picsart-api-key: <API KEY HERE>' \
  -H 'Content-Type: multipart/form-data' \
  -F 'output_type=cutout' \
  -F 'format=PNG' \
  -F 'image_url=' 
const FormData = require('form-data');
const http = require("https");
const form = new FormData();
const fs = require('fs');

form.append('bg_blur', '0');
form.append('scale', 'fit');
form.append('image_url', '');
form.append('bg_image_url', '');
form.append('format', 'JPG');
form.append('output_type', 'cutout');
const options = {
    "method": "POST",
    "hostname": "",
    "port": null,
    "path": "/tools/1.0/removebg",
    "headers": {
        "accept": "application/json",
        "X-Picsart-API-Key": "YOURAPIKEYHERE",
const req = http.request(options, function (res) {
    const chunks = [];
    res.on("data", function (chunk) {
    res.on("end", function () {
        const body = Buffer.concat(chunks);
req.on("error", (e) => {
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("multipart/form-data");
RequestBody body = new MultipartBody.Builder()
  .addFormDataPart("image_url", "")
  .addFormDataPart("bg_image_url", "")
Request request = new Request.Builder()
  .method("POST", body)
  .addHeader("accept", "application/json")
  .addHeader("X-Picsart-API-Key", "YOURAPIKEYHERE")

Response response = client.newCall(request).execute();
import requests
url = ""

  "bg_blur": "0",
  "scale": "fit",
  "image_url": "",
  "bg_image_url": "",
  "format": "JPG",
  "output_type": "cutout"}
headers = {"accept": "application/json", "X-Picsart-API-Key": "YOURAPIKEY"}

response = requests.request("POST", url, headers=headers, data=payload, files=files)


To remove the background from an image using the Remove Background API, make a POST request to with the following parameters:

  • accept: Set the value to application/json to indicate the desired response format.
  • x-picsart-api-key: Replace with your actual API Key obtained from Picsart.
  • Content-Type: Set the value to multipart/form-data to indicate the request format.
  • output_type: Specify the desired output type, such as cutout.
  • format: Specify the desired format for the resulting image, such as PNG.
  • image_url: Provide the URL of the image you want to process.