Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

ImageMagick on AWS Lambda

ImageMagick can be easily run on AWS Lambda to perform image manipulation by means of SCAR.

Local Usage

Assuming that you want to use the /tmp directory for input and output image files:

docker run --rm -v /tmp:/tmp grycap/imagemagick convert 

Usage in AWS Lambda via SCAR

You can run ImageMagick in AWS Lambda via SCAR to automatically perform image manipulation (for example to convert to grayscale) on images uploaded to the input folder of the scar-test S3 bucket by using the following procedure:

  1. Create the Lambda function
scar init -f scar-imagemagick.yaml
  1. Upload a file to the S3 bucket
scar put -b scar-imagemagick/input -p homer.png

The converted image to grayscale will be available in s3://scar-imagemagick/output/homer.png

  1. Download a file from the S3 bucket
scar get -b scar-imagemagick/output -p /tmp/

The image will be downloaded in the path /tmp/output/homer.png.

The first invocation will take considerable longer time than most of the subsequent invocations since the container will be cached.

You can upload as many images as you want. Multiple concurrent Lambda invocations will be performed to transform the images.