https://fapihub.com/v2/rembg/gradient/
Result


Headers
Your API token.
Body
The image file to process. Send as multipart form data.
Top color in RGB format.
Bottom color in RGB format.
Code Samples
curl -X POST "https://fapihub.com/v2/rembg/gradient/" \
-H "ApiKey: API_TOKEN" \
-F "image=@image.jpg" \
-F "top_color=(255, 140, 0, 255)" \
-F "bottom_color=(229, 46, 113, 255)"
import requests
response = requests.post(
"https://fapihub.com/v2/rembg/gradient/",
headers={"ApiKey": "your_api_token"},
files={"image": open("image.jpg", "rb")},
data={
"top_color": "(255, 140, 0, 255)",
"bottom_color": "(229, 46, 113, 255)"
}
)
if response.status_code == 200:
with open("gradient.png", "wb") as f:
f.write(response.content)
const formData = new FormData();
formData.append("image", fileInput.files[0]);
formData.append("top_color", "(255, 140, 0, 255)");
formData.append("bottom_color", "(229, 46, 113, 255)");
fetch("https://fapihub.com/v2/rembg/gradient/", {
method: "POST",
headers: { "ApiKey": "your_api_token" },
body: formData
})
.then(response => response.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "gradient.png";
a.click();
});
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://fapihub.com/v2/rembg/gradient/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ["ApiKey: your_api_token"],
CURLOPT_POSTFIELDS => [
"image" => new CURLFile("image.jpg"),
"top_color" => "(255, 140, 0, 255)",
"bottom_color" => "(229, 46, 113, 255)"
]
]);
$response = curl_exec($curl);
file_put_contents("gradient.png", $response);
curl_close($curl);
?>
Responses
Binary image data (the processed image with background removed)
{
"error": {
"code": "invalid_image",
"message": "The uploaded file is not a valid image format",
"request_id": "req_abc123"
}
}
{
"error": {
"code": "invalid_api_key",
"message": "The provided API key is invalid or expired",
"request_id": "req_abc123"
}
}
{
"error": {
"code": "insufficient_credits",
"message": "Your account has insufficient credits. Please upgrade your plan.",
"request_id": "req_abc123"
}
}
{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests. Please wait before making more requests.",
"request_id": "req_abc123",
"retry_after": 60
}
}
