- Serverless Image handler
- Convert an Image from .jpg/.png to .webp
- What is Webp?
- Steps for the image conversion
- Step 1: Creating an S3 bucket
- Step 2: Creating cloud formation
What is the document for?
This document explains how to convert images from
Serverless Image handler
This solution creates a serverless architecture to initiate cost-effective image processing in the AWS Cloud. The architecture combines AWS services with Sharp open-source image processing software and is optimized for dynamic image manipulation. The solution provides dynamic image handling to help maintain high-quality images on your websites and mobile applications to drive user engagement.
Serverless Image Handler | Implementations | AWS Solutions
What does this AWS Solution do? This solution creates a serverless architecture to initiate cost-effective image processing in the AWS Cloud. The architecture combines AWS services with Sharp open-source image processing software and is optimized for dynamic image manipulation. The solution provides dynamic image handling to help you maintain high-quality images on your websites and mobile applications to drive user engagement.
Convert an Image from
What is Webp?
The WebP format has become increasingly popular since Google introduced it in 2010. Its biggest selling point lies in its ability to produce much smaller file sizes while maintaining similar image quality. Faster load times = higher conversion rates.
WebP is a modern image format that provides superior lossless and lossy compression for images on the web. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25–34% smaller than comparable JPEG images at an equivalent SSIM quality index. — Google
Serverless architecture for cost-effective image processing
Publication date: June 2017 (last update: December 2021) The Serverless Image Handler solution helps you embed images on your websites and mobile applications to drive user engagement. It uses to provide high-speed image processing without sacrificing image quality.
Image Resizer + deployment + cloudfront CND (1MB to .5KB) reduced size by 1/2048 (format webp ext)
Your website is too slow, you are probably loading a lot of high-resolution images. want to reduce image sizes & cost without losing image quality. Here's your solution: This is how to use AWS infrastructure to use a cost-effective image resizing & delivery system in an affordable & effective manner.
Steps for the image conversion
Step 1: Creating an S3 bucket
First, Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/. Create a new S3 bucket with public access.
Reference to create S3 bucket: https://docs.aws.amazon.com/AmazonS3/latest/userguide/creating-bucket.html
Step 2: Creating cloud formation
In this step, we are going to upload the AWS cloud formation template to automate the deployment of the Serverless Image Handler solution in the AWS Cloud. It includes the following AWS CloudFormation template, which you can download before deployment:
Open the cloud formation console at https://console.aws.amazon.com/cloudformation/.
Creating a new stack:
- Step 1: Specify the Template
- Prerequisite - Prepare Template: choose the Template is ready
- Specify Template: choose to Upload a template file
- Upload the downloaded serverless-image-handler.template file
- Go to the next step
- Step 2: Specify stack details
- Stack name: Enter the stack name
- Parameters: Just change the mentioned options here; other options keep as it is
- CORS Options:
- CORS Enabled: select yes
- Image Sources:
- Source Buckets: Your S3 bucket name
- Demo UI: select No
- Auto Webp: select yes
- Step 3: We aren't changing any options here; if you need some specific options to be enabled here, you can enable them.
- Step 4:
- Check ✅ I acknowledge that AWS CloudFormation might create IAM resources.
- Check ✅ The Template has changed.
- Create stack The Creation will take a few minutes to set up.
After the stack is created, go to the outputs tab there, and you can see the API endpoint URL. Use that Url to hit the S3 images.
- Normal S3 URL: https://fes-cdn.s3.amazonaws.com/assets/category-card/against-whom-category.jpg
- Converting jpg to webp: Add the filter - filtersformat(webp) to the Cloud front URL: https://dhn3tko1o6cib.cloudfront.net/filtersformat(webp)/assets/category-card/against-whom-category.jpg
- Not only webp filter, there are other supported filters we can use:
- List of supported filters: https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/thumbor-filters.html
❌ We can't pass filterformat to SVG images.