Background Removal API

STEP 1

Click to Get API KEY

By default, a newly created account will have 1 free High Resolution If you want to test our API, feel free to contact us, we will add free high resolution credits to your account.

STEP 2

Use the following code samples to get started quickly.

FINISH

Getting back to the parameters reference to adjust the request.

cURL

Python

Node

Copy

$ curl -X POST "https://api.pixmiller.com/v1/remove" \

-H "X-Api-Key: YOUR_API_KEY_HERE" \

-F "image_file=@path/to/img.jpg" \

-F "size=full"

Copy

# Requires "requests" to be installed (see python-requests.org)

import requests

response = requests.post(

'https://api.pixmiller.com/v1/remove',

files={'image_file': open('path/to/img.jpg', 'rb')},

data={'size': 'full'}, # auto | preview | full

headers={'X-Api-Key': 'YOUR_API_KEY_HERE'},

)

if response.status_code == 201:

with open('img_removed.png', 'wb') as out:

img_removed_url = response.json()["url"]

out.write(requests.get(img_removed_url).content)

else:

print("Error:", response.status_code, response.text)

Copy

// Requires "request" to be installed (see https://www.npmjs.com/package/request)

var request = require('request');

var fs = require('fs');

request.post({

url: 'https://api.pixmiller.com/v1/remove',

formData: {

image_file: fs.createReadStream('/path/to/file.jpg'),

size: 'full', // auto|preview|full

},

headers: {

'X-Api-Key': 'YOUR_API_KEY_HERE'

},

encoding: null

}, function(error, response, body) {

if(error) return console.error('Request failed:', error);

if(response.statusCode != 201) return console.error('Error:', response.statusCode, body.toString('utf8'));

var stream = fs.createWriteStream("img_removed.png");

request(JSON.parse(body.toString('utf8')).url).pipe(stream).on('close', function(){});

});