Extraction and Conversion¶
Image intelligence and format conversion — extract metadata, detect dominant colours, fetch favicons, and convert between formats.
Endpoints¶
| Method | Endpoint | Purpose |
|---|---|---|
POST |
/v1/image/extract/metadata |
Read EXIF and other metadata from a base64 image |
GET |
/v1/image/extract/metadata |
Read metadata from an image URL |
POST |
/v1/image/extract/colors |
Extract dominant colours from a base64 image |
GET |
/v1/image/extract/colors |
Extract colours from an image URL |
GET |
/v1/image/favicon |
Fetch the highest-resolution favicon for a domain |
POST |
/v1/image/convert |
Convert and return JSON/base64 output |
GET |
/v1/image/convert |
Convert and stream a file |
GET |
/v1/image/download/{object_name} |
Download a previously processed image |
Examples¶
Extract image metadata (EXIF)¶
curl "https://image.toolkitapi.io/v1/image/extract/metadata?url=https://example.com/photo.jpg" \
-H "X-API-Key: YOUR_KEY"
import requests
resp = requests.get(
"https://image.toolkitapi.io/v1/image/extract/metadata",
params={"url": "https://example.com/photo.jpg"},
headers={"X-API-Key": "YOUR_KEY"},
)
data = resp.json()
# EXIF data if available
if data.get("exif"):
print(f"Camera: {data['exif'].get('Make', 'Unknown')} {data['exif'].get('Model', '')}")
print(f"Taken: {data['exif'].get('DateTimeOriginal')}")
print(f"GPS: {data['exif'].get('GPSInfo', 'Not available')}")
# Basic properties
print(f"Format: {data['format']}, Size: {data['width']}x{data['height']}")
print(f"File size: {data['file_size_bytes']} bytes")
const params = new URLSearchParams({ url: "https://example.com/photo.jpg" });
const resp = await fetch(
`https://image.toolkitapi.io/v1/image/extract/metadata?${params}`,
{ headers: { "X-API-Key": "YOUR_KEY" } }
);
const data = await resp.json();
console.log(`${data.format} ${data.width}x${data.height}, ${data.file_size_bytes} bytes`);
Response
{
"format": "JPEG",
"width": 4032,
"height": 3024,
"file_size_bytes": 2456789,
"exif": {
"Make": "Apple",
"Model": "iPhone 15 Pro",
"DateTimeOriginal": "2024-06-15T14:30:00",
"GPSInfo": {"latitude": 37.7749, "longitude": -122.4194}
}
}
Extract dominant colours¶
curl "https://image.toolkitapi.io/v1/image/extract/colors?url=https://example.com/brand.jpg" \
-H "X-API-Key: YOUR_KEY"
import requests
resp = requests.get(
"https://image.toolkitapi.io/v1/image/extract/colors",
params={"url": "https://example.com/brand.jpg"},
headers={"X-API-Key": "YOUR_KEY"},
)
data = resp.json()
for color in data["colors"][:5]:
print(f" {color['hex']} — {color['percentage']}% ({color['name']})")
const params = new URLSearchParams({ url: "https://example.com/brand.jpg" });
const resp = await fetch(
`https://image.toolkitapi.io/v1/image/extract/colors?${params}`,
{ headers: { "X-API-Key": "YOUR_KEY" } }
);
const data = await resp.json();
data.colors.forEach(c => console.log(`${c.hex} (${c.percentage}%)`));
Response
{
"url": "https://example.com/brand.jpg",
"colors": [
{"hex": "#FF5733", "name": "Persimmon", "percentage": 42.5, "rgb": [255, 87, 51]},
{"hex": "#FFFFFF", "name": "White", "percentage": 28.3, "rgb": [255, 255, 255]},
{"hex": "#333333", "name": "Dark Gray", "percentage": 15.1, "rgb": [51, 51, 51]}
],
"query_time_ms": 245.6
}
Fetch a favicon¶
curl "https://image.toolkitapi.io/v1/image/favicon?domain=github.com" \
-H "X-API-Key: YOUR_KEY"
import requests
resp = requests.get(
"https://image.toolkitapi.io/v1/image/favicon",
params={"domain": "github.com"},
headers={"X-API-Key": "YOUR_KEY"},
)
data = resp.json()
print(f"Favicon URL: {data['favicon_url']}")
print(f"Size: {data['width']}x{data['height']}")
const params = new URLSearchParams({ domain: "github.com" });
const resp = await fetch(
`https://image.toolkitapi.io/v1/image/favicon?${params}`,
{ headers: { "X-API-Key": "YOUR_KEY" } }
);
const data = await resp.json();
console.log(`Favicon: ${data.favicon_url} (${data.width}x${data.height})`);
Convert image format¶
# POST variant returns JSON with base64
curl -X POST "https://image.toolkitapi.io/v1/image/convert" \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/photo.jpg", "format": "webp", "quality": 85}'
import requests
import base64
resp = requests.post(
"https://image.toolkitapi.io/v1/image/convert",
headers={"X-API-Key": "YOUR_KEY"},
json={"url": "https://example.com/photo.jpg", "format": "webp", "quality": 85},
)
data = resp.json()
with open("converted.webp", "wb") as f:
f.write(base64.b64decode(data["image"]))
print(f"Converted {data['from_format']} → {data['to_format']}: {data['size_bytes']} bytes")
const resp = await fetch("https://image.toolkitapi.io/v1/image/convert", {
method: "POST",
headers: { "X-API-Key": "YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ url: "https://example.com/photo.jpg", format: "webp", quality: 85 }),
});
const data = await resp.json();
console.log(`Converted ${data.from_format} → ${data.to_format}`);
Common parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
string | Yes* | Public URL to source image |
image |
string | Yes* | Base64-encoded image data |
format |
string | No | Output format for convert endpoints: png, jpeg, webp, gif, bmp, tiff |
quality |
integer | No | Output quality 1–100 (JPEG/WebP). Default: 85 |
Tip
Use GET endpoints when you want raw binary response (suitable for <img> tags or file downloads). Use POST endpoints when you need JSON-wrapped base64 output for programmatic handling.