Skip to content

Serverless image optimization pipeline on AWS with 90-98% compression. Built with Lambda, S3, and API Gateway.

License

Notifications You must be signed in to change notification settings

Anshuman-git-code/serverless-image-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Image Optimization Pipeline

A serverless image processing pipeline built on AWS that automatically optimizes and resizes high-resolution images for web use.

Status AWS Python

Screen.Recording.2025-12-02.at.11.10.02.AM.mov

🎯 Overview

This project provides an automated solution for image optimization, perfect for CMS systems, portfolios, blogs, and e-commerce platforms. Upload high-resolution images and receive optimized versions in multiple resolutions (1080p, 720p, 480p) with 90-98% file size reduction.

✨ Features

  • Automated Processing: Upload triggers automatic resizing and compression
  • Multiple Resolutions: Generates 1080p, 720p, and 480p versions
  • High Compression: 90-98% file size reduction with minimal quality loss
  • Fast Processing: 0.6-6 seconds depending on image size
  • Secure: Pre-signed URLs, no exposed AWS credentials
  • Professional UI: Modern dark theme with drag-and-drop upload
  • Cost-Effective: $0 cost (within AWS Free Tier)

πŸ—οΈ Architecture

Screenshot 2025-12-01 at 10 36 19β€―AM

πŸš€ Live Demo

Frontend URL: http://image-pipeline-frontend-sid.s3-website.ap-south-1.amazonaws.com

πŸ“Š Performance

  • Compression: 90-98% file size reduction
  • Processing Time: 0.6-6 seconds
  • Quality: Minimal visible degradation
  • Formats Supported: JPEG, PNG, BMP, TIFF, GIF

Example Results

Original Size Processed Size Reduction Time
6.7 MB 677 KB 90% 1.83s
14.4 MB 222 KB 98% 2.5s
175 KB 90 KB 49% 0.63s

πŸ› οΈ Technology Stack

Frontend

  • HTML5, CSS3, JavaScript (Vanilla)
  • S3 Static Website Hosting

Backend

  • AWS Lambda (Python 3.11)
  • Pillow (PIL) for image processing
  • Boto3 (AWS SDK)

Infrastructure

  • Amazon S3 (Storage)
  • AWS API Gateway (REST API)
  • AWS IAM (Security)
  • AWS CloudWatch (Monitoring)

πŸ“ Project Structure

image-optimization-pipeline/
β”œβ”€β”€ frontend/                    # Web application
β”‚   β”œβ”€β”€ index.html              # Main HTML
β”‚   β”œβ”€β”€ styles.css              # Professional dark theme
β”‚   └── app.js                  # Frontend logic
β”œβ”€β”€ lambda-functions/           # AWS Lambda functions
β”‚   β”œβ”€β”€ image-processor/        # Main processing Lambda
β”‚   β”œβ”€β”€ generate-upload-url/    # Pre-signed URL generator
β”‚   └── get-processed-images/   # Download URL generator
β”œβ”€β”€ docs/                       # Documentation
β”‚   β”œβ”€β”€ architecture/           # System design
β”‚   β”œβ”€β”€ implementation/         # Implementation details
β”‚   └── testing/                # Test results
└── scripts/                    # Deployment scripts

πŸš€ Deployment

Prerequisites

  • AWS Account
  • AWS CLI configured
  • Python 3.11

Quick Start

  1. Clone the repository
git clone https://github.com/yourusername/image-optimization-pipeline.git
cd image-optimization-pipeline
  1. Deploy Lambda Functions
# Deploy image processor
cd lambda-functions/image-processor
zip -r function.zip .
aws lambda update-function-code --function-name ImageProcessorLambda --zip-file fileb://function.zip

# Deploy other Lambda functions similarly
  1. Deploy Frontend
cd frontend
aws s3 sync . s3://your-frontend-bucket/
  1. Configure API Gateway

πŸ“– Documentation

πŸ”’ Security

  • IAM roles with least-privilege access
  • Pre-signed URLs with time expiration
  • No AWS credentials in frontend
  • CORS configuration
  • S3 bucket encryption (AES-256)

πŸ’° Cost Analysis

Current Usage: $0.00 (within AWS Free Tier)

AWS Free Tier Limits:

  • Lambda: 1M requests + 400,000 GB-seconds/month
  • S3: 5 GB storage + 20,000 GET + 2,000 PUT requests
  • API Gateway: 1M API calls/month

Projected Cost (10,000 images/month): ~$3.15/month

πŸ‘₯ Team

  • Anshuman - Team Lead + Frontend Developer

    • API Gateway setup
    • Frontend development
    • Integration and testing
    • Bug fix (PNG transparency)
  • Shivam - Backend Developer

    • Image processing Lambda
    • Resize and compression logic
  • Siddhant - Infrastructure Specialist

    • S3 buckets configuration
    • IAM roles and permissions
    • Pre-signed URL Lambda functions

πŸ› Known Issues

  • None currently

πŸ”„ Future Enhancements

  • WebP format conversion
  • Watermarking support
  • Custom resolution selection
  • Batch processing
  • AWS Cognito authentication
  • Real-time progress updates

πŸ“ License

This project is licensed under the MIT License.

πŸ™ Acknowledgments

  • AWS for providing excellent cloud services
  • Pillow library for image processing capabilities
  • The open-source community

πŸ“§ Contact

For questions or feedback, please open an issue on GitHub.


Built with ❀️ using AWS Serverless Architecture

About

Serverless image optimization pipeline on AWS with 90-98% compression. Built with Lambda, S3, and API Gateway.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published