Skip to content

Instantly share code, notes, and snippets.

@veelenga
Forked from bensie/imagemagick.bash
Last active May 17, 2022 23:43
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save veelenga/dd7b6c3ea9aac339d803ef7c3013d226 to your computer and use it in GitHub Desktop.
Save veelenga/dd7b6c3ea9aac339d803ef7c3013d226 to your computer and use it in GitHub Desktop.
ImageMagick Static Binaries with HEIC support for AWS Lambda
#!/usr/bin/env bash
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at:
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html
#
# As of Jan 10, 2019, this is:
# Amazon Linux AMI 2017.03.1.20170812 x86_64 HVM GP2 (ami-4fffc834)
#
# Lambda includes ImageMagick 6.7.8-9 preinstalled, so you need to prepend PATH
# with the folder containing these binaries in your Lambda function to ensure
# these newer binaries are used.
#
# In a NodeJS runtime, you would add something like the following to the top of
# your Lambda function file:
# process.env['PATH'] = process.env['LAMBDA_TASK_ROOT'] + '/imagemagick/bin:' + process.env['PATH']
# make/install libde265
git clone https://github.com/strukturag/libde265 && cd libde265
./configure && make && sudo make install
# make/install libheif
git clone https://github.com/strukturag/libheif && cd libheif
./configure && make && sudo make install
# make install Image Magick with HEIC support
version=7.0.8-23
sudo yum -y install libpng-devel libjpeg-devel libtiff-devel gcc
curl -O https://imagemagick.org/download/ImageMagick-$version.tar.gz
tar zxvf ImageMagick-$version.tar.gz
cd ImageMagick-$version
./configure --prefix=/var/task/imagemagick --enable-shared=no --enable-static=yes --with-heic
make && sudo make install
tar zcvf ~/imagemagick.tgz /var/task/imagemagick/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment