Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
osotorrio opened this issue Sep 26, 2015 · 50 comments
Closed

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

osotorrio opened this issue Sep 26, 2015 · 50 comments

Comments

@osotorrio
Copy link

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
Copy link

+1

@donghanji
Copy link

+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
Copy link

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
Copy link

In my case, reinstall homebrew and install graphicsMagic again.

@moranm6
Copy link

moranm6 commented Oct 7, 2015

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

@donghanji
Copy link

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
Copy link

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
Copy link

jonas-db commented Nov 2, 2015

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
Copy link

kmsheng commented Nov 4, 2015

+1 on mac

@rwky
Copy link
Contributor

rwky commented Dec 1, 2015

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 rwky closed this as completed Dec 1, 2015
@leegee
Copy link

leegee commented Dec 15, 2015

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
Copy link

@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
Copy link

-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
Copy link

leegee commented Dec 17, 2015

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
#455 (comment).

@vanthome
Copy link

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
Copy link

ghigt commented Jan 12, 2016

same as @vanthome

@ktruckenmiller
Copy link

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
Copy link
Contributor

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

but not gm in node.js

@tomericco
Copy link

+1 on mac

@bluemix
Copy link

bluemix commented Sep 6, 2016

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

@phantomk
Copy link

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

@yunusde
Copy link

yunusde commented Sep 21, 2016

this works for me.

brew install imagemagick
brew install graphicsmagick

@mylonasg88
Copy link

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
Copy link

Talbot3 commented Nov 7, 2016

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

  • imagemagick
  • graphicsmagick-imagemagick-compat
    请尝试:sudo apt install <选定的软件包>

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

@shivashanmugam
Copy link

shivashanmugam commented Dec 25, 2016

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
Copy link

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
Copy link

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
Copy link

pj-alvarado10 commented Oct 11, 2017

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
Copy link

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

@ziwer1
Copy link

ziwer1 commented May 14, 2018

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

@katja-brunner
Copy link

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

  • install graphicsmagick from http://www.graphicsmagick.org/, not the node plugin
  • install gm node plugin from https://github.com/aheckmann/gm
  • add graphicsmagick installation folder and node js installation folder to your system path variable, e.g. C:\Program Files\GraphicsMagick-1.3.29-Q8;C:\Program Files\nodejs
  • if you worked with cmd console, restart it to adopt system path variable changes! (that was my problem)

@Andrey7287
Copy link

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
Copy link

Hi, How do you work on Linux?

@Andrey7287
Copy link

Hi, just install graphicsmagic, see tip above.
#455 (comment)

@xuya227939
Copy link

xuya227939 commented Jun 21, 2018

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

@dominicfarraribm
Copy link

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

@zhubenjie
Copy link

windows

 Error: Command failed: convert: UnableToOpenConfigureFile `magic.xml' @ warning/configure.c/GetConfigureOptions/714.

@damogallagher
Copy link

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
Copy link

otanim commented Oct 3, 2018

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
Copy link

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
Copy link

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
Copy link

+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
Copy link

xeroxstar commented Dec 4, 2019

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
Copy link

dotupNET commented Feb 3, 2020

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
Copy link

It works for me

brew install imagemagick
brew install graphicsmagick

@g8up
Copy link

g8up commented Apr 10, 2020

On windows , check this option when installing:
image

@msrumon
Copy link

msrumon commented Jun 29, 2020

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
Copy link

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
Copy link

wsilva94 commented Mar 31, 2023

Case use Docker with node:18+alpine try this

install imagemagick, graphicsmagick, ffmgeg and

RUN apk add --no-cache imagemagick ffmpeg graphicsmagick

@ramanabhinav7
Copy link

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

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

No branches or pull requests