The gm/convert binaries can't be found
I am running Nodejs v4.1.1 in Windows 10 (64-bit). When I execute the following code:
var gm = require('gm').subClass({imageMagick: true});
gm('C:/Images/myImage.png').identify(function (err, data) { if (err) { console.log(err); }else{ console.log(data); }});
I get the next error message:
gm { domain: Domain { domain: null, _events: { error: [Function] }, _eventsCount: 1, _maxListeners: undefined, members: [] }, _events: { identify: [Function] }, _eventsCount: 1, _maxListeners: undefined, _options: { imageMagick: true }, data: {}, _in: [], _out: [], _outputFormat: null, _subCommand: 'convert', source: 'C:/Images/myImage.png', _sourceFormatters: [ [Function] ], _identifyState: 1, bufferStream: false }
[Error: Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-verbose" "C:/Images/myImage.png" this most likely means the gm/convert binaries can't be found]
+1
In my case, reinstall homebrew and install graphicsMagic again.
+1 on windows. Tried restarting and installing with npm install -g gm
If I were you, I would try this:
sudo ln -s /usr/local/bin/gm /usr/bin/gm
sudo ln -s /usr/local/bin/convert /usr/bin/convert
How do i fix this? i'm on windows 8.1 and i've installed this link: ImageMagick-6.9.2-5-Q16-x64-dll.exe
It seems you have to add .options({imageMagick: true}), works fine now :)
+1 on mac
You need to install the binaries (convert/gm) and this module. The binary install will depend on your OS and you should check their respective documentation.
Should I open a new ticket for this?
I can find convert but it seems gm cannot.
Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "/Users/lee/src/jsscroll/bin/../htdocs/img/passmore-fg.small.png" "-edge" "2" "-resize" "1000x" "[object Object]" this most likely means the gm/convert binaries can't be found
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/gm/lib/command.js:299:14)
at emitOne (events.js:77:13)
at ChildProcess.emit (events.js:169:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
at onErrorNT (internal/child_process.js:344:16)
at doNTCallback2 (node.js:439:9)
at process._tickCallback (node.js:353:17)
at Function.Module.runMain (module.js:469:11)
at startup (node.js:134:18)
at node.js:961:3
14:57:05 $ which convert
/usr/local/bin/convert
14:59:27 $ convert --version
Version: ImageMagick 6.9.2-8 Q8 x86_64 2015-12-15 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib cairo fontconfig freetype gvc jng jpeg lcms ltdl lzma png rsvg tiff webp xml zlib
14:59:39 $
@leegee +1 here. Same problem in windows. The convert command working perfectly in the command line but if i try run this with node:
function gmConvert(from, format, to) {
return new Promise((resolve, reject) => {
gm(from).setFormat(format).write(to, (err) => {
if (err) return reject(err);
resolve(to);
});
});
}
//Example parameters:
from -> D:\Programing\Nodejs\gmconv\testfile.NEF
to -> D:\Programing\Nodejs\gmconv\testfile.png
format -> png
I gave this error:
[Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "D:\Programing\Nodejs\gmconv\testfile.NEF" "png:D:\Programing\Nodejs\gmconv\testfile.png" this most likely means the gm/convert binaries can't be found]
But if i run this command:
convert testfile.NEF image.png
Its working perfectly
-1 Sorry it was my fault. I found a solution. I installed imagemagick and i forgot about subClass:
let imageMagick = gm.subClass({imageMagick: true});
imageMagick(...).write(...) //now working
Now its working perfectly
Exactly the same here — took me a long time to work that out: I reinstalled absolutely everything....!
Is it the docs or is it me?
On 16/12/2015 11:12, Metál Ádám wrote:
-1 Sorry it was my fault. I found a solution. I installed imagemagick and i forgot about subClass:
let imageMagick= gm.subClass({imageMagick: true});
imageMagick(...).write(...)//now working
Now its working perfectly
— Reply to this email directly or view it on GitHub https://github.com/aheckmann/gm/issues/455#issuecomment-165056011.
I also get this on Linux:
Error: Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%wx%h" "-" this most likely means the gm/convert binaries can't be found
the convert command is installed and works however.
same as @vanthome
Tried @devmetal solution and it worked.
I was running Alpine Linux in a docker container and I installed with
....
RUN apk add --update imagemagick
....
Then I just added this in my require within my node script:
const gm = require('gm').subClass({imageMagick: true});
same ubuntu, convert image.jpg new.jpg , works well.
but not gm in node.js
+1 on mac
thanks to @ktruckenmiller, this worked with me (on Mac):
const gm = require('gm').subClass({imageMagick: true});
think to @ktruckenmiller , after installed ImageMagick on CentOS7, and subClass, it worked
this works for me.
brew install imagemagick brew install graphicsmagick
On linux
Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "image.jpg" "-resize" "240x240" "/pdfOutput/res.jpg" this most likely means the gm/convert binaries can't be found
Solution
sudo apt install graphicsmagick