A simple API for image compression.
To compress an image, send a POST request to the /api/compress
endpoint with a file.
POST /api/compress
The request body should be a multipart/form-data payload containing your image file with the field name image
.
Content-Type: multipart/form-data
image: <your_image_file>
The service supports all common image formats including PNG, JPEG, GIF, and BMP. There is a file size limit of 50 MB. All images will be converted to a compressed JPEG format.
The API will return the compressed image as a binary file. The response will also include two custom headers that you can use to check the compression results:
X-Original-Size
: The original size of the image in bytes.X-Compressed-Size
: The compressed size of the image in bytes.