Image Reducer API
Compress, resize, and optimize images for web use.
POST/api/image/image-reducer
Reduce image size and optimize quality.
Request Body
| Field | Type | Description |
|---|---|---|
| imageDataUri | string | Required. Source image (URL or Data URI). |
| quality | number | Optional. Compression quality (1-100). Default `80`. |
| width | number | Optional. Resize to target width (px). |
| format | string | Optional. `'jpeg'`, `'png'`, `'webp'`, or `'original'`. |
Example Request
curl -X POST 'https://codingmantra.com/api/image/image-reducer' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"imageDataUri": "https://example.com/large-photo.jpg",
"quality": 75,
"width": 1024,
"format": "webp"
}'Example Response
{
"data": {
"photoDataUri": "data:image/webp;base64,...",
"originalSize": 5000000,
"compressedSize": 250000
}
}