small vedios 1 min
// 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.remove.bg/v1.0/removebg',
formData: {
image_file: fs.createReadStream('/path/to/file.jpg'),
size: 'auto',
},
headers: {
'X-Api-Key': 'INSERT_YOUR_API_KEY_HERE'
},
encoding: null
}, function(error, response, body) {
if(error) return console.error('Request failed:', error);
if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8'));
fs.writeFileSync("no-bg.png", body);
});