The Image Processor is a Spring Boot application designed to upload, compress, and serve images. It supports both PNG and JPEG image formats and utilizes external tools like pngquant
and jpegoptim
for efficient compression.
The Image Processor allows users to upload images in either PNG or JPEG format. Upon upload, the application compresses the image based on the specified quality and serves the compressed image for download.
This endpoint handles image upload and compression.
- Method: POST
- Parameters:
file
: The image file to upload (MultipartFile)quality
: The quality parameter for JPEG compression (Integer)
- Response: Compressed image as a downloadable file
This class is responsible for handling image upload, compression, and serving compressed images.
uploadAndCompressImage
: Handles image upload, compression, and serves the compressed image.
This class defines a REST controller for handling image upload and compression requests.
uploadAndCompressImage
: Forwards the upload request to theImageProcessor
and serves the compressed image.
This class contains the main method to start the Spring Boot application.
- Start the Spring Boot application.
- Access the
/uploadImage
endpoint to upload and compress images. - Specify the
file
parameter (image) to upload and thequality
parameter (for JPEG compression). - Compressed images are available for download with the provided link.
Please note that the pngquant
and jpegoptim
tools must be available on the system where the application is deployed.
- Spring Boot
pngquant
(for PNG image compression)jpegoptim
(for JPEG image compression)