Search⌘ K
AI Features

Using `mogrify`

Explore how to apply the mogrify command-line tool for image thumbnail creation within AWS Lambda. Learn to add mogrify to Lambda environments using Lambda layers and deploy reusable components from the AWS Serverless Application Repository. Understand packaging and compiling binaries for serverless applications.

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 ...