ImageMagick after execution environment update


Is ImageMagick binary no longer included in the new execution environment or the Node.js 10.x runtime?

Current working environment: Node.js 6.10
Fails to work when a development alias is updated (times out at 60 seconds), but works again when the delay layer is added.
The same code bundle on a new deployment using Node.js 10.x runtime displays the message:
"Could not execute GraphicsMagick/ImageMagick: convert [COMMAND ARGS] this most likely means the gm/convert binaries can't be found"

I'm using the NPM package gm v1.23.1. Snippet below:

const gm = require('gm').subClass({ imageMagick: true })
let writeStream = fs.createWriteStream(pdfFile)
let convert = gm().command('convert')
for(let page of pages)'pdf', (err, stdout, stderr) => {

Edited by: aku-sch on Jul 1, 2019 5:07 PM

asked 4 years ago382 views
6 Answers


ImageMagick is no longer bundled with the Node.js 10.x runtime. There are two options to get ImageMagick working with your Node.js 10.x function:

  1. Package the dependency and include it in your uploaded ZIP file
  2. Create or use a Lambda Layer that includes ImageMagick


answered 4 years ago

I am new to all this Node stuff, what do you mean by "Package the dependency and include it in your uploaded ZIP file"? how can I do that? I am trying to use Node 10.x for image conversions using AWS Lambda. Please help!


answered 3 years ago
answered 3 years ago

I ended up going through the process myself and it does indeed work.

To save you some time here's a zip file you can use to create a Lambda Layer.

When you create the layer make sure you add Node.js 10.x as a supported runtime. You can then set your function to use the latest Node.js 10.x and add the layer you created. The image conversion should then work again!

Edited by: connorB09b on Oct 20, 2019 5:20 AM

answered 3 years ago

Many thanks for this resource. We faced similar issue and used the zip file you provided and it worked. Can you please explain the process in creating the zip. We still have some issues with respect to image color and want to further investigate.


answered 3 years ago

@connorB09b Thank you for posting your zip file, Connor!

Unfortunately, after we uploaded it as a new Lambda layer on our aws-lambda-image, it still didn't work for us.

This worked fine with NodeJS 8.10, but since we've been forced to upgrade (to either NodeJS 10.x or 12.x), it's not working even with the zip file.

I am familiar with layers, and I think i followed the instructions correctly. Can you think of anything further i need to do?

The Lambda is running in us-east-1 if that makes any difference.


answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions