Image Compress API
The Image Compress API from Gugudata enables developers to efficiently compress and optimize images via API. Whether you're working with user-uploaded files or image URLs, this API provides full control over compression quality, resizing, and format conversion.
Designed for integration into high-performance websites, mobile applications, and content management systems (CMS), this API helps reduce bandwidth usage and improve image loading speeds without compromising on visual quality.
๐ View full API documentation
๐ง Manage your appkey & usage
๐ง Features Overview
- Supports both file upload and image URL processing
- Customizable compression quality (1โ95, default: 85)
- Flexible size control: set exact target dimensions or max constraints
- Maintains image aspect ratio automatically
- Optional format conversion: JPEG, PNG, etc.
- Handles large image files (up to 10MB)
- High-performance API with load balancing
- TLS 1.0โ1.3 supported, fully HTTPS and Apple ATS compatible
- Distributed CDN across regions for fast response
๐ API Endpoint
-
URL:
https://api.gugudata.io/v1/image/image-compress -
Method:
POST -
Content-Type:
multipart/form-dataorapplication/x-www-form-urlencoded - Test the API: Demo here
๐งพ Request Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
appkey |
string | Yes | YOUR_APPKEY | Your API key from Gugudata. Required for authentication. |
file |
file | No | N/A | Upload an image file (JPEG, PNG, etc.). Provide either file or image_url, not both. |
image_url |
string | No | N/A | Public image URL to process. Provide either image_url or file, not both. |
targetWidth |
integer | No | N/A | Desired width (px). Will maintain aspect ratio. |
targetHeight |
integer | No | N/A | Desired height (px). Will maintain aspect ratio. |
maxWidth |
integer | No | N/A | Maximum allowed width. Image will be resized if larger. |
maxHeight |
integer | No | N/A | Maximum allowed height. Image will be resized if larger. |
quality |
integer | No | 85 | Compression level (1โ95). Higher = better quality. |
format |
string | No | original | Output format (e.g., jpeg, png). Defaults to original format. |
๐ค Response Format
The API responds with a binary stream of the compressed image.
-
Content-Type: Based on the image format (e.g.,
image/jpeg) - Response: Direct binary image data
Make sure your client handles binary image responses correctly.
โ Error Codes
| Code | Message | Description |
|---|---|---|
| 200 | Normal return | Image compressed successfully |
| 400 | Parameter error | Invalid or missing parameters; file or URL required |
| 402 | APPKEY error | Invalid or unauthorized appkey |
| 403 | Account in arrears | Service blocked due to unpaid usage |
| 429 | Too many requests | Exceeded 100 requests/second |
| 500 | Server error | Internal processing error |
| 503 | Service unavailable | External service is currently down |
๐ก Example Request
curl -X POST "https://api.gugudata.io/v1/image/image-compress" \
-H "Content-Type: multipart/form-data" \
-F "appkey=YOUR_APPKEY" \
-F "file=@your-image.jpg" \
-F "quality=80" \
-F "format=jpeg"
Or using a URL:
curl -X POST "https://api.gugudata.io/v1/image/image-compress" \
-d "appkey=YOUR_APPKEY" \
-d "image_url=https://example.com/image.png" \
-d "quality=75" \
-d "maxWidth=800"
โ Use Case Scenarios
- Website Performance: Compress homepage banners and thumbnails before delivery.
- User Uploads: Optimize profile pictures or gallery images in real time.
- CMS Integration: Automatically resize and convert images during publishing.
- E-Commerce: Generate optimized product images for faster loading.
- Mobile Apps: Reduce bandwidth and storage for image-heavy apps.
๐ Developer Resources
- ๐งญ API Details: https://gugudata.io/details/image-compress
- ๐ Dashboard / API Key Management: https://gugudata.io/dashboard
- ๐ API Status: https://www.gugudata.com/status
- ๐ Website: https://gugudata.io
The Image Compress API is ideal for developers building performance-oriented platforms with rich media content. With intelligent optimization and high-speed delivery, it streamlines your image pipeline while preserving quality.

Top comments (0)