Edit Images
POST /v1/images/edit
Perform editing operations on images including resize, crop, watermark, format conversion, and filters.
Request
| Field | Type | Required | Description |
|---|---|---|---|
src | string | Yes | Source image URL |
operations | array | Yes | List of operations to apply in order |
output | object | No | Output format options |
Resize
curl -X POST https://api.vidiking.com/v1/images/edit \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"src": "https://example.com/photo.jpg",
"operations": [
{ "type": "resize", "width": 800, "height": 600, "fit": "cover" }
],
"output": { "format": "webp", "quality": 85 }
}'
Node.js
const result = await client.images.edit({
src: 'https://example.com/photo.jpg',
operations: [
{ type: 'resize', width: 800, height: 600, fit: 'cover' },
],
output: { format: 'webp', quality: 85 },
});
console.log(result.url);
Python
result = client.images.edit(
src="https://example.com/photo.jpg",
operations=[
{"type": "resize", "width": 800, "height": 600, "fit": "cover"},
],
output={"format": "webp", "quality": 85},
)
print(result.url)
Crop
{
"src": "https://example.com/photo.jpg",
"operations": [
{ "type": "crop", "x": 100, "y": 50, "width": 800, "height": 600 }
]
}
Watermark
{
"src": "https://example.com/photo.jpg",
"operations": [
{
"type": "watermark",
"image": "https://example.com/logo.png",
"position": "bottom-right",
"opacity": 0.5,
"scale": 0.15,
"padding": 20
}
]
}
Watermark positions: top-left, top-center, top-right, center, bottom-left, bottom-center, bottom-right.
Filters
{
"src": "https://example.com/photo.jpg",
"operations": [
{ "type": "filter", "name": "grayscale" }
]
}
Available filters:
| Filter | Description |
|---|---|
grayscale | Convert to grayscale |
sepia | Apply sepia tone |
blur | Gaussian blur (use amount for intensity) |
sharpen | Sharpen the image |
brightness | Adjust brightness (use amount: -100 to 100) |
contrast | Adjust contrast (use amount: -100 to 100) |
saturate | Adjust saturation (use amount: -100 to 100) |
Chaining Operations
Apply multiple operations in sequence:
curl -X POST https://api.vidiking.com/v1/images/edit \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"src": "https://example.com/photo.jpg",
"operations": [
{ "type": "resize", "width": 1200, "height": 1200, "fit": "cover" },
{ "type": "filter", "name": "brightness", "amount": 10 },
{ "type": "filter", "name": "contrast", "amount": 15 },
{ "type": "watermark", "image": "https://example.com/logo.png", "position": "bottom-right", "opacity": 0.4 }
],
"output": { "format": "png" }
}'
Format Conversion
Convert between image formats by specifying the output format:
{
"src": "https://example.com/photo.png",
"operations": [],
"output": { "format": "webp", "quality": 90 }
}
Supported formats: jpg, png, webp, gif, avif.
Response
{
"id": "edit_abc123",
"url": "https://cdn.vidiking.com/images/edit_abc123.webp",
"width": 800,
"height": 600,
"format": "webp",
"file_size": 45200,
"credits_used": 1,
"created_at": "2025-01-15T10:30:00Z"
}
Cost
Image editing operations cost 1 credit per request regardless of the number of operations applied.