- Version
- Download 6
- File Size 453.94 KB
- File Count 1
- Create Date 03/11/2025
- Last Updated 03/11/2025
Image Auto-Compression using Sharp and AWS Lambda
Ms. Farhina S. Sayyad
Dept. Of Computer Engineering
D. Y. Patil College Of Engineering
Savitribai Phule Pune University,
Pune,India
fssayyad@dypcoeakurdi.ac.in
Aishwarya Shirgavi
Dept. Of Computer Engineering
D. Y. Patil College Of Engineering
Savitribai Phule Pune University,
Pune,India
aishushirgave98@gmail.com
Abstract— In today’s digital era, users frequently upload high-resolution images, which often lead to system performance issues, slower load times, and excessive cloud storage usage. Manual image optimization remains inefficient and prone to human error for both developers and end-users. This paper introduces an automated, serverless image optimization pipeline utilizing AWS Lambda in combination with the Sharp.js library. When an image is uploaded to Amazon S3, it activates a Lambda function that automatically compresses and optimizes the image into a web-friendly format without noticeable quality degradation. This approach enables real-time image compression without the need for backend server management, thereby minimizing storage requirements, improving application speed, and enhancing user experiences across various platforms.
In the modern internet-driven landscape, images represent a significant portion of the data transmitted across both web and mobile applications. Studies indicate that over 65% of webpage data weight is attributed to images, underlining the necessity of efficient image management. While high-resolution visuals are crucial for superior user engagement, they increase bandwidth consumption, load time, and cloud storage expenses. Traditional optimization approaches demand manual pre-processing or rely on specialized backend servers, which introduces inefficiency, cost, and maintenance challenges.
This study proposes a completely automated, serverless pipeline for image compression and optimization using AWS Lambda and Sharp.js. Leveraging AWS Lambda’s eventdriven framework, the system triggers compression operations whenever new images are uploaded to S3. Sharp.js, built upon the efficient libvips engine, performs resizing and compression operations while maintaining visual quality. The integration of serverless computing with this high-performance library ensures real-time automation, scalability, and cost efficiency. Furthermore, this research introduces two innovative enhancements:
1. A Deep Reinforcement Learning (DRL)-based predictive resource provisioning mechanism that mitigates cold start latency.
2. A Semantic-Aware Adaptive Compression (S-ADC) algorithm that intelligently modifies compression settings based on image content and semantic complexity.
Experimental evaluations conducted across formats such as JPEG, PNG, WebP, and AVIF reveal considerable reductions in file size while preserving visual fidelity. The proposed system not only enhances accessibility for users with limited bandwidth but also reduces cloud expenses and supports sustainable computing
practices. By merging serverless infrastructure with adaptive intelligence, this work delivers a scalable, cost-effective, and eco- friendly solution for image optimization applicable to real-world web and mobile platforms.
Keywords—Cloud Computing, Serverless Architecture, AWS Lambda, Sharp.js, Image Compression, Reinforcement Learning, Adaptive Compression, Media Optimization, Cloud Efficiency.






