Image Magick with Jets on Lambda

I am trying to figure out how to package a binary to do simple image resizing in Lambda with Jets. I couldn’t find anything on this topic and was wondering if you guys had any insight?

Using something like gem 'image_magick' for the resizing.

I’m not a Lambda expert, but I think you can add a Lambda Layer with the image_magick executable and configure Jets to use it.


This layer might be what you’re looking for:

Let me know if you are successful, it would be great to add an example to the Jets docs.

Ah, you’re right. That sounds like a great idea. And they even have a nice little way to do it :smiley:

https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:145266761615:applications~image-magick-lambda-layer

Now I need to see if it is possible with Jets to apply the layer only to one function. That’d be great.

Good news! You probably don’t need an extra lambda layer after all.

I dug a little deeper and discovered that the Linux image that is used by AWS Lambda for Ruby already has a version of Image Magick.

https://aws.amazon.com/amazon-linux-ami/2018-03-packages/

My guess is that you should be able to make it work as long as the gem you are using is simply using the executables, e.g. mini_magick.

Good luck!

Huh thats weird because my code was failing at the convert methods. I was using mini_magick’s combine_options and nothing was ever returned not even a peep of an error. I assumed it was the binary or something.

Huh that’s annoying.

I didn’t test the mini_magick gem, but I wrote a simple controller that printed all executables in all folders in ENV['PATH'], and convert was there.

Maybe you can play around with MiniMagick.configure to help it find the executables?

Sorry, I wish I could help more.