Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Option to specify path for ImageMagick in gm #51

Open
shukriadams opened this issue Jan 1, 2017 · 3 comments
Open

Option to specify path for ImageMagick in gm #51

shukriadams opened this issue Jan 1, 2017 · 3 comments

Comments

@shukriadams
Copy link

I'm having a problem getting image-diff to work on some systems. I cannot reliably include ImageMagick in my OS's PATH, as I have another utility called "convert.exe" already in PATH. When image-diff calls ImageMagick's convert.exe via gm, it hits the wrong convert.exe.

gm has a workaround for this - you can initialize it with options.appPath where appPath is the path to ImageMagick, bypassing the need to map it at the OS level. This of course requires that image-diff also has an appPath option. I have a quick-and-dirty example at https://github.com/shukriadams/image-diff/blob/master/lib/image-diff.js (line 248-ish), would it be possible it implement something similar to this?

Thanks.

@twolfson
Copy link
Contributor

twolfson commented Jan 2, 2017

I'm down for supporting this but it seems strange there is no environment variable to do that (e.g. libraries will often allow PHANTOMJS_BIN or similar to specify the executable path). I'm going to open an issue on gm to see if we can add that support so all dependent libraries don't need to support passing in appPath

@shukriadams
Copy link
Author

Thanks - that sounds like a better approach. Also, I noticed that your createDiff flow calls imageMagic directly, instead of via gm, and it also assumes imageMagic is added to PATH.

@twolfson
Copy link
Contributor

twolfson commented Jan 2, 2017

Ah, good eye. I'm sure we can replace that with gm's _exec or _spawn when the upstream issue is settled and we upgrade for support

https://github.com/aheckmann/gm/blob/1.23.0/lib/command.js#L180-L208

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants