aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 616 forks source link

The gm/convert binaries can't be found #455

Closed osotorrio closed 8 years ago

osotorrio commented 9 years ago

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]

jeonghwan-kim commented 9 years ago

+1

donghanji commented 9 years ago

+1

also this issue:

[Error: Could not execute GraphicsMagick/ImageMagick: convert "a.png" "-resize" "300x300!" "b.png" this most likely means the gm/convert binaries can't be found]

donghanji commented 9 years ago

First,should install GraphicsMagic,in Mac:

brew install GraphicsMagick

if install graphicsmagick by this way,you should config PATH:

Second,vim bash_profile,to export graphicsmagick path:

vim ~/.bash_profile

add this code in bash_profile:

export PATH=${PATH}:/usr/local/Cellar/graphicsmagick/1.3.21/bin

(notice:this is my graphicsmagick path,chang it as yours)

Third,reboot your term,and restart your server.

good luck ^_^

jeonghwan-kim commented 9 years ago

In my case, reinstall homebrew and install graphicsMagic again.

moranm6 commented 9 years ago

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

donghanji commented 9 years ago

moranm6 ,I think you shouldn't install graphicsMagic or ImageMagick,not a npm module,which are Stand-alone programs.

see here: about graphicsmagick:http://www.graphicsmagick.org/index.html about gm:https://github.com/aheckmann/gm

good luck ^_^

kenberkeley commented 8 years ago

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
jonas-db commented 8 years ago

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

kmsheng commented 8 years ago

+1 on mac

rwky commented 8 years ago

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.

leegee commented 8 years ago

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 $
devmetal commented 8 years ago

@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 commented 8 years ago

-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

leegee commented 8 years ago

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.

vanthome commented 8 years ago

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.

ghigt commented 8 years ago

same as @vanthome

ktruckenmiller commented 8 years ago

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

wahengchang commented 8 years ago

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

but not gm in node.js

tomericco commented 8 years ago

+1 on mac

bluemix commented 8 years ago

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

phantomk commented 8 years ago

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

yunusde commented 8 years ago

this works for me.

brew install imagemagick brew install graphicsmagick

mylonasg88 commented 7 years ago

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

Talbot3 commented 7 years ago

@mylonasg88 that is nice. I Use Ubuntu 16.04 x64bit,and when I run code "man conver" ,there has two statment: 程序 'convert' 已包含在下列软件包中:

then did this code in terminal: apt-get install graphicsmagick-imagemagick-compat that Ok

shivashanmugam commented 7 years ago

Windows solution There is a scenario it worked when i renamed file 'magick.exe' to 'convert.exe' inside C:\Program Files\ImageMagick-[Version No]

Shadow-Wizard commented 7 years ago

For me it was bad node.js installation, as explained here.

In short, you need to remove a trailing slash from node.js path.

codeinaire commented 7 years ago

Ubuntu 16.04. Using image-to-ascii in a javascript app. Error: [ Error: Stream yields empty buffer ....bunch of other stuff.... Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%wx%h" "-" this most likely means the gm/convert binaries can't be found .....bunch of other stuff..... ]

Solution: sudo apt install graphicsmagick

@mylonasg88 thanks!

pj-alvarado10 commented 7 years ago

I love everybody! Thank you for your answers!

I use Windows. My problem was:

parsing error. Error. Could not execute GraphicsMagick/ImageMagick: identify "-ping" "-format" "%wx%n" "./uploads/a69of3ee-2fc8-4946-b1d2-b5fco64df3fbfimagejpg" this most likely means the gm/conven binaries can't be found

First, like @moranm6 say, in cdm I write npm install -g gm

After, I download and install the next programs (the most easy way): Ghostscript (Win64bits): https://www.ghostscript.com/download/gsdnld.html GraphicsMagick: https://graphicsmagick.en.softonic.com/ ImageMagick: https://imagemagick.en.softonic.com/

And the program in node.js worked!

aghiadyazji commented 6 years ago

I had the same problem on Windows make sure to check the option 'Install legacy utils' as mentioned here when installing ImageMagick

ziwer1 commented 6 years ago

If you are on windows, install GraphicsMagick instead of ImageMagick. http://www.graphicsmagick.org/download.html

katja-brunner commented 6 years ago

Had the same issue on Windows 7 and solved it that way:

Andrey7287 commented 6 years ago

Ok, now I can run gm on linux and windows , but how will it work on server ? I tried to run my app at heroku and have got same error :(

xuya227939 commented 6 years ago

Hi, How do you work on Linux?

Andrey7287 commented 6 years ago

Hi, just install graphicsmagic, see tip above. https://github.com/aheckmann/gm/issues/455#issuecomment-255204399

xuya227939 commented 6 years ago

Yes, I took the corresponding graphicsmagick installed on the above, or prompted the error. I am sure that the installation is successful.

dominicfarraribm commented 6 years ago

This works. takes 2 seconds. I tried everything on here and it didn't work. this worked. -> http://macappstore.org/imagemagick/

zhubenjie commented 6 years ago

windows

 Error: Command failed: convert: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/714.
damogallagher commented 6 years ago

Hi

Is anyone aware of a nodejs library that will you to set a watermark on an image with installing imagemagick and graphicsmagick? I want to be able to deploy a watermark service to AWS Lambda

otanim commented 6 years ago

for Ubuntu 16.04 LTS, according to @yunusde's solution, this works for me:

sudo apt-get install imagemagick
sudo apt-get install graphicsmagick
JonathandelaSen commented 5 years ago

I know this is so closed but I was having problems on Debian 9 with resizing images using "apt-get install graphicsmagick-imagemagick-compat" solution. "sudo apt-get install imagemagick" was the right solution for me.

jackslocum commented 5 years ago

After digging through the source, I found this solution for MacOS / Linux (will likely work on Windows too with appropriate path):

let gm = require('gm').subClass({appPath: '/usr/local/bin/'});

10001oleg commented 5 years ago

+1

also this issue:

[Error: Could not execute GraphicsMagick/ImageMagick: convert "a.png" "-resize" "300x300!" "b.png" this most likely means the gm/convert binaries can't be found]

same error

xeroxstar commented 4 years ago

I tried every solution were mentioned here and no success, if i run in console the gm command, works fine but if i run with the npm, i get same error [Error: Could not execute GraphicsMagick/ImageMagick: convert "a.png" "-resize" "300x300!" "b.png" this most likely means the gm/convert binaries can't be found]

i installed on windows the GraphicsMagick-1.3.32-Q16 i restarted the pc, i installed npm install gm -g and here is my code:


const gm = require('gm').subClass({addPath:'C://Program Files (x86)/GraphicsMagick-1.3.32-Q16'});
gm('C://Users/user/Pictures/Chucks_0823.jpg').size(function (err, size) {
        console.log(err)
});
dotupNET commented 4 years ago

I tried every solution were mentioned here and no success, if i run in console the gm command, works fine but if i run with the npm, i get same error [Error: Could not execute GraphicsMagick/ImageMagick: convert "a.png" "-resize" "300x300!" "b.png" this most likely means the gm/convert binaries can't be found]

i installed on windows the GraphicsMagick-1.3.32-Q16 i restarted the pc, i installed npm install gm -g and here is my code:


const gm = require('gm').subClass({addPath:'C://Program Files (x86)/GraphicsMagick-1.3.32-Q16'});
gm('C://Users/user/Pictures/Chucks_0823.jpg').size(function (err, size) {
        console.log(err)
});

try this of course with your correct path: take care of your /

const gm = require('gm').subClass({ imageMagick: true, appPath: path.normalize('C:/Program Files/ImageMagick-7.0.9-Q8/') });

asotoglez commented 4 years ago

It works for me

brew install imagemagick
brew install graphicsmagick
g8up commented 4 years ago

On windows , check this option when installing: image

msrumon commented 4 years ago

Same problem here: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%m" "C:\Users\****\AppData\Local\Temp\ckc0sl1q40001iky9at0meiyz" this most likely means the gm/convert binaries can't be found. I have installed GraphicsMagick on my Windows 10 by choco install graphicsmagick. Path also has been set w/ the installation process. I can access various commands exposed by gm, but I can't make it work on my Node.js project. Do I have to install 'ImageMagick' as well? I don't think so, GraphicsMagick is forked from ImageMagick w/ lots of added benefits. This library doc also mentions to install one of them. Then why is it not working? Any idea?

IMPORTANT! Windows users, restart your PC. It somewhat was required for me.

FullStackZz commented 4 years ago

Windows platform: 1.download and install GraphicsMagick or ImageMagick windows version: http://www.graphicsmagick.org/ http://www.imagemagick.org/ 2.add to windows env path CMD gm -version / convert -version 3.run node demo

wsilva94 commented 1 year ago

Case use Docker with node:18+alpine try this

install imagemagick, graphicsmagick, ffmgeg and

RUN apk add --no-cache imagemagick ffmpeg graphicsmagick

ramanabhinav7 commented 5 months ago

Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found" i have used npm install imagemagick and npm i gm but still this is showing in windows please help me const { fromPath } = require('pdf2pic');

const options = { density: 100, saveFilename: "untitled", savePath: "", format: "jpeg", width: 600, height: 600 };

const convert = fromPath('invoice.pdf', options); const pageToConvertAsImage = 1;

convert(pageToConvertAsImage, { responseType: "image" }) .then((resolve) => { console.log("Page 1 is now converted as JPEG");

return resolve;

}); below is the error cb(new Error('Could not execute GraphicsMagick/ImageMagick: '+cmd+" this most likely means the gm/convert binaries can't be found")); ^

Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "-density" "100x100" "-quality" "75" "-[0]" "-resize" "600x600!" "-compress" "jpeg" "untitled.1.jpeg" this most likely means the gm/convert binaries can't be found at ChildProcess. (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\gm\lib\command.js:249:12) at ChildProcess.emit (node:events:514:28) at cp.emit (C:\Users\ABHINAV KUMAR\Desktop\Node_jsm\innovice_jaishreemahakal\node_modules\cross-spawn\lib\enoent.js:36:37) at ChildProcess._handle.onexit (node:internal/child_process:294:12)

Node.js v20.9.0