Tuesday 28 November 2017

On Demand Image Resizing With AWS

Delivering the image according to the device and resolution is always a big challenge. If you want to convert the image dynamically based on the resolution without using any expensive service provider like cloudinary, here is the solution for you which uses the Amazon resources.

AWS offers a simple solution that automatically deploys and configures a serverless architecture that is optimized for dynamic image manipulation. The diagram below presents the Serverless Image Handler architecture you can deploy in minutes using the solution's implementation guide and accompanying AWS CloudFormation template.


  • Amazon CloudFront provides a caching layer to reduce the cost of image processing.
  • Amazon API Gateway provides API endpoint powered by AWS Lambda functions to dynamically make image modifications.
  • AWS Lambda retrieves the image from the existing Amazon Simple Storage Service (Amazon S3) bucket and uses Thumbor to return a modified version of the image to the API Gateway.
  • The API Gateway returns the new image to CloudFront for delivery to end-users.

To implement this solution simply click on this link

The On demand image manipulation is done by the Thumbor service and it offers lots of filters, to see full list of available options click on this link

Finally you can resize the image with the url like http://cloudfront…/500x500/path/image01.jpg

You can apply filters like http://cloudfront…/filters:blur(80)/path/image01.jpg

You can combine both the resize and filters.

Refference: http://docs.aws.amazon.com/solutions/latest/serverless-image-handler/deployment.html