This is a Heroku buildpack for vendoring the ImageMagick with WebP and HEIF support binaries into your project.
This buildpack works with BOTH Heroku stack heroku-20
and heroku-22
.
Add this buildpack to your app:
heroku buildpacks:add https://github.com/alois-gaucher/heroku-buildpack-imagemagick-webp -i 1 -a <app name>
And add it into your app.json
:
"buildpacks": [
{
"url": "https://github.com/alois-gaucher/heroku-buildpack-imagemagick-webp"
},
{
"url": "heroku/ruby"
}
],
See folder test/sample_app
for an example app and instructions for deploying it to heroku-22
or heroku-20
stacks.
When you use this buildpack it unpacks a pre-built build/imagemagick.tar.gz
file into your Heroku application's /./vendor
folder and sets up the relevant environment variables.
If you were to run a Heroku bash
session you can investigate the dependencies:
$ heroku run -a <appname> bash
~ $ convert -version
Version: ImageMagick 7.1.1-15 Q16-HDRI x86_64 98eceff6a:20230729 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP(4.5)
Delegates (built-in): bzlib djvu fontconfig freetype heic jbig jng jpeg lcms lqr lzma openexr png tiff webp x xml zip zlib
Compiler: gcc (9.4)
~ $ dwebp -version
1.3.1
~ $ heif-info -h
heif-info libheif version: 1.16.2
To update the dependencies you have the following steps:
-
Update the
Dockerfile
-
Re-build the
build/imagemagick.tar.gz
file./build.sh (Builds Dockerfile.22 by default)
./build.sh 20 (To build Dockerfile.20)
-
Git the changes, including the tar.gz file, and push to your fork
-
Purge your Heroku application's cache
heroku builds:cache:purge
-
Redeploy your application via the Heroku dashboard, or push a new commit.