Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install imagemagick inside of electron app

We have an electron app that uses Imagemagick on OSX, we have pre-installed that with brew install. It works fine in development, but when we package the app - it cant find imagemagick.

Can we brew install imagemagick before setting up the app? How would we go about doing this?

like image 757
jrutter Avatar asked Jul 11 '17 16:07

jrutter


1 Answers

If using electron-builder (which I recommend) you can simply add a postinstall script to your package.json to install Imagemagick

In package.json

"scripts": {
    "postinstall": "brew install imagemagick"
}

Alternatively if you don't want to install it, or brew might not already be available on target machines, you can install imagemagick into a folder within the app then add that to the extraResources key of package.json

"extraResources": ["imagemagick/"]

This will tell electron-builder to bundle this folder into the archive. Then just reference imagmagick from that folder.

like image 199
AlienHoboken Avatar answered Sep 20 '22 11:09

AlienHoboken