There are a few options; one is to modify the Heroku NodeJS buildpack, and add the necessary scripts to download and compile ImageMagick.
https://devcenter.heroku.com/articles/buildpacks#using-a-custom-buildpack
Secondarily, you could use exec
to check for convert
or some other part of IM, and run an install script if it isn't present.
var exec = require('child_process').exec;
exec('convert', function(error, stdout, stderr) {
if (error) {
exec('./install_script', function(error, stdout, stderr) {
if (!error) {
initApp();
}
});
} else {
initApp();
}
});
As to the install script, take a look at this link; I'm using it in a grunt task (that compiles on npm install
), but I can verify that Heroku will compile it.
In that example, note that I'm not running make install
to make the binaries globally available; I'm not sure if that's possible at that point in Heroku's initialization. If not, you could see if node-imagemagick allows you to specify the binary path, or go the buildpack route.