Lossless Image Compression

Overview

Welcome to our Lossless Image Compression API, designed to help developers easily compress images. We provide a simple and intuitive /upload endpoint that supports various image formats. This API uses a streaming response method to deliver real-time processing updates, and provides a download link once the processing is complete.

Features

  • Lossless Compression: Compressed images retain their original quality, making it suitable for applications requiring high-fidelity images.
  • Real-Time Status Updates: Users can receive real-time updates on the upload and processing states through streaming responses.
  • Download Link: After processing is completed, a direct download link for the compressed image will be provided.

API Endpoint

1. Upload Image

  • Endpoint: /upload
  • Method: POST
  • Request Format: multipart/form-data
  • Request Parameters:
    • file: The image file to be compressed (supports JPG, PNG, etc.).

2. Response Format

This API responds with multiple JSON objects through a streaming format, indicating different processing states.

A sample response:

{"status":"uploaded","fileName":"173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg","originalFileName":"photo_2024-03-27_14-27-23.jpg"}
{"status":"processing","fileName":"173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg","originalFileName":"photo_2024-03-27_14-27-23.jpg"}
{"status":"processing","fileName":"173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg","originalFileName":"photo_2024-03-27_14-27-23.jpg"}
{"status":"processing","fileName":"173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg","originalFileName":"photo_2024-03-27_14-27-23.jpg"}
{"status":"completed","fileName":"173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg","originalFileName":"photo_2024-03-27_14-27-23.jpg","compressedSize":47352,"downloadUrl":"https://proxyimgcpr.scitudy.com/download/173cb12144036037786e4a8fb1a1408d323709637579fdcf40d0fc34e02c4898.jpg/photo_2024-03-27_14-27-23.jpg"}

You should wait longer time for completed status to get the downloadUrl.

Response Field Descriptions

  • status: The current processing status, which can be uploaded, processing, or completed.
  • fileName: The name of the compressed file.
  • originalFileName: The name of the original file.
  • compressedSize: The size of the compressed file (only returned in completed status).
  • downloadUrl: The link to download the compressed file (only returned in completed status).

Use Cases

  • Website Optimization: Compress images on your website to improve page loading speed and enhance user experience.
  • Application Development: Upload and compress images from users in mobile apps to save data and speed up app responsiveness.
  • Social Media: Quickly process user-uploaded photos, making them suitable for sharing and storage.

Troubleshooting

  • Upload Failure: Ensure that the file format is correct and does not exceed size limits.
  • Long Processing Time: We recommend being patient when dealing with large images, as processing time may vary based on image size and server load.

Conclusion

Our Lossless Image Compression API provides an efficient, real-time, and reliable service to help you manage your document and image resources effortlessly. If you have any questions or feedback, please feel free to contact us.