Server
https://benzin.io/api/removeBackground
Using algorithms of neural network automatically removes background from any image
- File size: up to 32 MB
- Image source: File upload (binary or as base64 string) or by URL
- Any images are available for processing
- Output resolutions: Preview, Full - original image resolution
- Requires X-Access-Token header
//Guzzle MULTIPART request - output_format: "image"
$client = new HttpClient(["base_uri" => "https://benzin.io"]);
$options = [
"multipart" => [
[
"name" => "image_file", "contents" => fopen("your-image.jpg", "r")
],
[
"name" => "size", "contents" => "full"
],
],
"headers" => [
"X-Access-Token" => "Your Api Key Here"
],
];
$response = $client->post("/api/removeBackground", $options);
$fout = fopen("response-image.png", "wb");
fwrite($fout, $response->getBody());
fclose($fout);
//Guzzle JSON request - output_format: "json"
$client = new HttpClient(["base_uri" => "https://benzin.io"]);
$options = [
"json" => [
"image_file_url" => "https://www.path/to-image.jpg",
"size" => "full",
"output_format" => "json"
],
"headers" => [
"X-Access-Token" => "Your Api Key Here"
],
];
$response = $client->post("/api/removeBackground", $options);
$response->getBody()->getContents();
//jQuery AJAX client JSON request - output_format: "json"
jQuery.ajax({
type: "POST",
url: "https://benzin.io/api/removeBackground",
dataType: "json",
contentType: "application/json",
headers:{
"X-Access-Token":"Your Api Key Here"
},
data: JSON.stringify({
"image_file_b64": "b64string", "size": "full", "output_format": "json"
}),
success: function (data) {
data = JSON.parse(data);
}
});