📸 ตัวลบพื้นหลังรูปภาพ (Background Remover)
1 ICต่อคำขอ
Image Background Remover เป็นบริการ AI สำหรับลบพื้นหลังของรูปภาพทุกประเภท รวมถึงรูปเซลฟี่ ซึ่งมีประโยชน์อย่างยิ่งสำหรับรูปติดบัตรและรูปถ่ายหน้าตรง
ลองใช้ Demo!
ทดล องใช้ AI Demo
เข้าสู่ระบบหรือสร้างบัญชีฟรีเพื่อใช้งาน AI Demo และสำรวจ API ที่ทรงพลังของเรา
รับ 50 เครดิตฟรี (IC) เมื่อสมัครสมาชิก!
โปรโมชันหมดเขต 31 ธันวาคม 2568
เริ่มต้นใช้งาน
-
สิ่งที่ต้องมี
- API key จาก บริษัท ไอแอพพ์เทคโนโลยี จำกัด
- รูปภาพทุกประเภท, รูปเซลฟี่, ที่มีประโยชน์สำหรับรูปติดบัตร
- รูปแบบไฟล์ที่รองรับ: JPEG, JPG, PNG
- ขนาดไฟล์สูงสุด: 2MB
-
เริ่มต้นใช้งานอย่างรวดเร็ว
- ประมวลผลรวดเร็ว
- ความแม่นยำสูง
-
คุณสมบัติหลัก
- ลบพื้นหลังของรูปเซลฟี่
- มีประโยชน์สำหรับรูปติดบัตรและรูปถ่ายหน้าตรง
- ห มุนเป็นโหมดแนวนอน
- มีประโยชน์สำหรับการใช้งานแอปพลิเคชันมือถือที่ง่ายขึ้น
-
ความปลอดภัยและการปฏิบัติตามข้อกำหนด
- เป็นไปตาม GDPR และ PDPA
- ไม่มีการเก็บข้อมูลหลังจากประมวลผล
วิธีรับ API Key?
กรุณาไปที่หน้า การจัดการ API Key เพื่อดู API key ที่มีอยู่ของคุณ หรือขอ API key ใหม่
API Endpoints
| Endpoint | Method | คำอธิบาย | ราคา |
|---|---|---|---|
/v3/store/smart-city/remove-backgroundLegacy: /face-extractor | POST | ลบพื้นหลังของรูปภาพ | 1 IC ต่อคำขอ |
Legacy: /remove-bg | POST | Endpoint สำหรับลบพื้นหลังแบบเก่า | 1 IC ต่อคำขอ |
ตัวอย่าง
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
| Name | Type | คำอธิบาย |
|---|---|---|
| apikey | String | API Key ของ ไอแอพพ์เทคโนโลยี AI |
Request Body
| Name | Type | คำอธิบาย |
|---|---|---|
| rotateIfPortiat | Boolean | หากพารามิเตอร์นี้ตั้งค่าเป็น "true" และภาพเป็นแนวตั้ง ผลลัพธ์จะถูกหมุนเป็นแนวนอน มีประโยชน์สำหรับการใช้งานแอปพลิเคชันมือถือที่ง่ายขึ้น |
| file | file | ไฟล์รูปภาพ .PNG หรือ .JPEG หรือ .JPG |
ตัวอย่างโค้ด
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);
}
ตัวอย่างโค้ด
Curl
curl -X POST https://api.iapp.co.th/v3/store/smart-city/remove-background \
-H "apikey: YOUR_API_KEY" \
-F "file=@/path/to/image.jpg"
Python
import requests
url = "https://api.iapp.co.th/v3/store/smart-city/remove-background"
files = {"file": ("("/path/to/image.jpg", "rb"))}
headers = {"apikey": "YOUR_API_KEY"}
response = requests.post(url, headers=headers, files=files)
print(response.json())
JavaScript
const axios = require("axios");
const FormData = require("form-data");
const fs = require("fs");
let data = new FormData();
data.append("file", fs.createReadStream("/path/to/image.jpg"));
let config = {
method: "post",
url: "https://api.iapp.co.th/v3/store/smart-city/remove-background",
headers: {
apikey: "YOUR_API_KEY",
...data.getHeaders(),
},
data: data,
};
axios(config)
.then((response) => console.log(response.data))
.catch((error) => console.log(error));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/v3/store/smart-city/remove-background',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => array(
'file'=> new CURLFILE('/path/to/image.jpg')
),
CURLOPT_HTTPHEADER => array(
'apikey: YOUR_API_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Swift
import Foundation
let url = URL(string: "https://api.iapp.co.th/v3/store/smart-city/remove-background")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "apikey")
let boundary = "Boundary-\(UUID().uuidString)"
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"file\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: image/jpeg\r\n\r\n".data(using: .utf8)!)
if let fileData = try? Data(contentsOf: URL(fileURLWithPath: "/path/to/image.jpg")) {
body.append(fileData)
}
body.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()
Kotlin
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
val client = OkHttpClient()
val file = File("/path/to/image.jpg")
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", file.name, file.asRequestBody("image/jpeg".toMediaTypeOrNull()))
.build()
val request = Request.Builder()
.url("https://api.iapp.co.th/v3/store/smart-city/remove-background")
.addHeader("apikey", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
Java
import okhttp3.*;
import java.io.File;
OkHttpClient client = new OkHttpClient();
File file = new File("/path/to/image.jpg");
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", file.getName(),
RequestBody.create(MediaType.parse("image/jpeg"), file))
.build();
Request request = new Request.Builder()
.url("https://api.iapp.co.th/v3/store/smart-city/remove-background")
.addHeader("apikey", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
Dart
import 'package:http/http.dart' as http;
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.iapp.co.th/v3/store/smart-city/remove-background')
);
request.files.add(await http.MultipartFile.fromPath(
'file',
'/path/to/image.jpg'
));
request.headers.addAll({
'apikey': 'YOUR_API_KEY'
});
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
ราคา
| ชื่อบริการ AI API | Endpoint | IC ต่อนาที | On-Premise |
|---|---|---|---|
| AI ลบพื้นหลังสำหรับรูปติดบัตร | remove_background_v1 | 1 IC/คำขอ | ติดต่อ |
