Page 1 of 1

Coders, filters and configuration paths

Posted: 2017-12-05T07:18:05-07:00
by redserpent7
Hi,

I am trying to bundle ImageMagick 7 in an AWS lambda function. I build ImageMagick from source with support for jpeg, png, webp, tiff, openjp2 and jbig. The library compiled fine and both magick and identify worked with no issues.

I copied the binaries, libraries along with the coders, filters and configuration xml files each to its own directory, packaged them all in my lambda function zip archive.

I then set the environment variables for each path from the AWS lambda console as such:

MAGICK_CODER_FILTER_PATH => /var/task/imagemagick/filters
MAGICK_CODER_MODULE_PATH => /var/task/imagemagick/coders
MAGICK_CONFIGURE_PATH => /var/task/imagemagick/config
LD_LIBRARY_PATH => /var/task/imagemagick/lib

I can verify that each of the directories mentioned above do exist on the lambda function environment as I started listing the files inside each one of those directories and indeed they are there with all their files.


Then I tried to execute this simple command

Code: Select all

/var/task/imagemagick/bin/magick /tmp/1.jpg /tmp/1.png
[/b] and I got the following:

Code: Select all

magick: unable to load module '/var/task/imagemagick/coders/jpeg.la': file not found @ error/module.c/OpenModule/1275.
magick: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/509.
I tried running

Code: Select all

ls -la /var/task/imagemagick/coders/jpeg.la
from the code and indeed the file does exist:

Code: Select all

-rwxrwxr-x 1 ec2-user ec2-user 1055 Dec  5 11:24 /var/task/imagemagick/coders/jpeg.la
What am I missing here?

Re: Coders, filters and configuration paths

Posted: 2017-12-05T07:58:48-07:00
by snibgo
I know nothing about "AWS lambda function". Is it a permissions problem?

Re: Coders, filters and configuration paths

Posted: 2017-12-05T08:34:26-07:00
by redserpent7
snibgo wrote: 2017-12-05T07:58:48-07:00 I know nothing about "AWS lambda function". Is it a permissions problem?
I don't think its a permission problem. I opened a linux EC2 instance and copied the package binaries, libs and files. set the environment variables as mentioned in the original post and I get the same error. As for AWS Lambda, you can think of it as a container if you will.