Search⌘ K
AI Features

Using `mogrify`

Explore how to use the mogrify utility for image processing within AWS Lambda functions, add necessary binary tools as Lambda layers, and leverage the AWS Serverless Application Repository to find and deploy reusable application components. Learn how to compile your own binaries for Lambda to extend functionality.

This chapter explains how to compose applications from third-party components by using Lambda layers. You will also learn about the AWS Serverless Application Repository, a public library of reusable application templates.

mogrify #

In the previous chapter, you built a skeleton for asynchronous processing. In this chapter, you’ll use that structure to create thumbnails from uploaded images. JavaScript isn’t really designed for working with binary files, and it would be better if you used a low-level system utility for image processing. For example, the mogrify command-line utility from the ImageMagick package can transform a wide range of image formats and is very easy to use. To modify a file into a thumbnail version, you can just use the -thumbnail option. Mogrify understands resolutions in the format Width x Height, but it can preserve aspect ratios if you provide only the width followed by the letter x. For example, to convert an image file into a 300-pixel wide thumbnail, you just need to run the ...