gm icon indicating copy to clipboard operation
gm copied to clipboard

The gm/convert binaries can't be found

Open osotorrio opened this issue 11 years ago • 48 comments

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]

osotorrio avatar Sep 26 '15 20:09 osotorrio

+1

jeonghwan-kim avatar Sep 27 '15 06:09 jeonghwan-kim

In my case, reinstall homebrew and install graphicsMagic again.

jeonghwan-kim avatar Sep 30 '15 07:09 jeonghwan-kim

+1 on windows. Tried restarting and installing with npm install -g gm

moranm6 avatar Oct 07 '15 19:10 moranm6

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

kenberkeley avatar Oct 29 '15 08:10 kenberkeley

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 :)

jonas-db avatar Nov 02 '15 11:11 jonas-db

+1 on mac

kmsheng avatar Nov 04 '15 09:11 kmsheng

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.

rwky avatar Dec 01 '15 16:12 rwky

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 avatar Dec 15 '15 14:12 leegee

@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

devmetal avatar Dec 16 '15 09:12 devmetal

-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

devmetal avatar Dec 16 '15 10:12 devmetal

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.

leegee avatar Dec 17 '15 09:12 leegee

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.

vanthome avatar Dec 22 '15 07:12 vanthome

same as @vanthome

ghigt avatar Jan 12 '16 10:01 ghigt

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});

ktruckenmiller avatar Feb 16 '16 22:02 ktruckenmiller

same ubuntu, convert image.jpg new.jpg , works well.

but not gm in node.js

wahengchang avatar May 24 '16 08:05 wahengchang

+1 on mac

tomericco avatar Aug 29 '16 07:08 tomericco

thanks to @ktruckenmiller, this worked with me (on Mac): const gm = require('gm').subClass({imageMagick: true});

bluemix avatar Sep 06 '16 18:09 bluemix

think to @ktruckenmiller , after installed ImageMagick on CentOS7, and subClass, it worked

phantomk avatar Sep 13 '16 09:09 phantomk

this works for me.

brew install imagemagick brew install graphicsmagick

yunusde avatar Sep 21 '16 14:09 yunusde

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

mylonasg88 avatar Oct 20 '16 19:10 mylonasg88