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
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.
Code: Select all
ls -la /var/task/imagemagick/coders/jpeg.la
Code: Select all
-rwxrwxr-x 1 ec2-user ec2-user 1055 Dec 5 11:24 /var/task/imagemagick/coders/jpeg.la