The rise in popularity and use of HEIF/HEIC(High Efficency Image Format) means your project's image processing also needs to be able to handle this format. The current default version of imagemagick installed on heroku:16 dynos is 18.104.22.168 and does not support processing heic image files. This Heroku buildpack vendors a version of ImageMagick with HEIF support binaries into your project. It is based on several resources including https://github.com/retailzipline/heroku-buildpack-imagemagick-heif.
The orginal buildpack was created for
heroku-18 stacks but this one was modified to work with Heroku stack:
The tar file in the /build folder currently contains:
You will need to build a new binary if you want to use a newer or different version. To build a new binary see How to Build a New Binary
This buildpack currently supports Heroku 16 and Heroku 20 and contains ImageMagick 7.0.11-4 Q16 x86_64 https://imagemagick.org
NOTE: To ensure the newer version of imagemagick is found in the $PATH and installed first make sure this buildpack is added to the top of the buildpack list or at "index 1".
From your projects "Settings" tab add this buildpack to your app in the 1st position:
From the command line:
heroku buildpacks:add https://github.com/HiMamaInc/heroku-buildpack-imagemagick-heif --index 1 --app HEROKU_APP_NAME
The binaries in this repo were built with Heroku Docker images running in a local dev environment. The tar file was then copied into the
/build directory in this repo and is used by the compile script.
To re-build all the binaries, run:
$ make build
To build the binary for a specific Heroku stack (for example, Heroku 16), run:
$ make build-heroku-16
Check the currently supported versions.
The binary files will be updated in the
/build folder. Commit and push to the repo.
Since the installation is cached you might want to clean it out due to config changes.
heroku plugins:install heroku-repo
heroku repo:purge_cache -app HEROKU_APP_NAME
Heroku provides Docker images that can be used to build code.
Those images can be referenced in
Makefile in this repo to build ImageMagick for a new Stack.
build-heroku-20: @docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-20" -w /buildpack heroku/heroku:20-build scripts/build_imagemagick imagemagick-heroku-20.tar.gz
In the example above we use the Docker image
heroku/heroku:20-build as well as passing the variable
heroku-20 and the output binary file as
Choose the Docker image that suits your Stack and make the appropriate changes to
/scripts/build_imagemagick script is executed in the Docker image that was specified in
Makefile. It will build ImageMagick with support to HEIC/HEIF based on the stack. A different Heroku stack that is not currently supported by this repository may require changes to the build script in order to succesfully compile the binary file.
https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1 https://github.com/brandoncc/heroku-buildpack-vips https://github.com/steeple-dev/heroku-buildpack-imagemagick https://github.com/retailzipline/heroku-buildpack-imagemagick-heif
Copy the snippet above into CLI.