Skip to main content

📸 Image Background Remover

📸 AI ลบพื้นหลังสำหรับตกแต่งรูปติดบัตร (ตัดหัวใส่เสื้อ) Version Status

Image Background Remover is an AI service for removing backgrounds from any kind of photos, selfie photos, particularly useful for ID photos and head-shot replacements.

Try Demo

Visit our API Portal to test the Image Background Remover API with your own images.

Getting Started

  1. Prerequisites

    • An API key from iApp Technology
    • Any kind of photos, selfie photos, particularly useful for ID photos
    • Supported file formats: JPEG, JPG, PNG
    • Maximum file size: 2MB
  2. Quick Start

    • Fast processing
    • High accuracy
  3. Key Features

    • Remove backgrounds from selfie photos
    • Useful for ID photos and head-shot replacements
    • Rotate into landscape mode
    • Useful for easier mobile application implementation.
  4. Security & Compliance

    • GDPR and PDPA compliant
    • No data retention after processing
How to get API Key?

Please visit API Portal to view your existing API key or request a new one.

Example

Request

curl --location 'https://api.iapp.co.th/face-extractor/predict/file' \
--header 'apikey: {YOUR API KEY}' \
--form 'file=@"/Users/iapp/Downloads/2 (3).png"' \
--form 'rotateIfPortiat="True"'

API Reference

Endpoint

POST https://api.iapp.co.th/face-extractor/predict/file

Headers

NameTypeDescription
apikeyStringiApp AI's API Key

Request Body

NameTypeDescription
rotateIfPortiatBooleanif this parameter is set as "true" and the image is portrait, the output will be rotated into landscape mode. Useful for easier mobile application implementation.
filefile.PNG or .JPEG or .JPG image file

Code Example

Python

import requests

url = "https://api.iapp.co.th/face-extractor/predict/file"

payload = {}
files=[
('file',('{YOUR UPLOADED FILE NAME}',open('{YOUR UPLOADED FILE PATH}','rb'),'image/png'))
]
headers = {
'apikey': '{YOUR_API_KEY}'
}

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

print(response.text)

JavaScript

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('file', fs.createReadStream('{YOUR UPLOADED FILE PATH}'));

let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.iapp.co.th/face-extractor/predict/file',
headers: {
'apikey': '{YOUR_API_KEY}',
...data.getHeaders()
},
data : data
};

axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/face-extractor/predict/file',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('{YOUR UPLOADED FILE PATH}')),
CURLOPT_HTTPHEADER => array(
'apikey: {YOUR_API_KEY}'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Swift

let parameters = [
[
"key": "file",
"src": "{YOUR UPLOADED FILE PATH}",
"type": "file"
]] as [[String: Any]]

let boundary = "Boundary-\(UUID().uuidString)"
var body = Data()
var error: Error? = nil
for param in parameters {
if param["disabled"] != nil { continue }
let paramName = param["key"]!
body += Data("--\(boundary)\r\n".utf8)
body += Data("Content-Disposition:form-data; name=\"\(paramName)\"".utf8)
if param["contentType"] != nil {
body += Data("\r\nContent-Type: \(param["contentType"] as! String)".utf8)
}
let paramType = param["type"] as! String
if paramType == "text" {
let paramValue = param["value"] as! String
body += Data("\r\n\r\n\(paramValue)\r\n".utf8)
} else {
let paramSrc = param["src"] as! String
let fileURL = URL(fileURLWithPath: paramSrc)
if let fileContent = try? Data(contentsOf: fileURL) {
body += Data("; filename=\"\(paramSrc)\"\r\n".utf8)
body += Data("Content-Type: \"content-type header\"\r\n".utf8)
body += Data("\r\n".utf8)
body += fileContent
body += Data("\r\n".utf8)
}
}
}
body += Data("--\(boundary)--\r\n".utf8);
let postData = body


var request = URLRequest(url: URL(string: "https://api.iapp.co.th/face-extractor/predict/file")!,timeoutInterval: Double.infinity)
request.addValue("{YOUR_API_KEY}", forHTTPHeaderField: "apikey")
request.addValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}

task.resume()

Kotlin

val client = OkHttpClient()
val mediaType = "text/plain".toMediaType()
val body = MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","{YOUR UPLOADED FILE NAME}",
File("{YOUR UPLOADED FILE PATH}").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.iapp.co.th/face-extractor/predict/file")
.post(body)
.addHeader("apikey", "{YOUR_API_KEY}")
.build()
val response = client.newCall(request).execute()

Java

OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","{YOUR UPLOADED FILE NAME}",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("{YOUR UPLOADED FILE PATH}")))
.build();
Request request = new Request.Builder()
.url("https://api.iapp.co.th/face-extractor/predict/file")
.method("POST", body)
.addHeader("apikey", "{YOUR_API_KEY}")
.build();
Response response = client.newCall(request).execute();

Dart

var headers = {
'apikey': '{YOUR_API_KEY}'
};
var request = http.MultipartRequest('POST', Uri.parse('https://api.iapp.co.th/face-extractor/predict/file'));
request.files.add(await http.MultipartFile.fromPath('file', '{YOUR UPLOADED FILE PATH}'));
request.headers.addAll(headers);

http.StreamedResponse response = await request.send();

if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}

Pricing

AI API Service NameEndpointIC Per MinuteOn-Premise
TRemove Background AI on Selfie Photo for Photo IDremove_background_v11 IC/MinuteContact