Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gm conversion issue in node.js

I am converting an image from jpg to png, but it is giving the error. Below is the code and error.

gm('E:/image1.jpg').write('E:/image2.png', function(err){
        if (err){
            console.log(err);
        } else{console.log('image converted.')}
    })

The error is:

[Error: Could not execute GraphicsMagick/ImageMagick: gm "convert" "E:/image1.jpg" "E:/image2.png" this most likely means the gm/convert binaries can't be found]

Do I have to npm graphicsmagick and imagemagick?

like image 788
JN_newbie Avatar asked Jul 03 '15 22:07

JN_newbie


3 Answers

Try brew install graphicsmagick. Does that resolve the error you saw?

like image 167
xke Avatar answered Oct 20 '22 22:10

xke


Probably graphicsmagick / imagemagick is not installed correctly, download GraphicsMagick or download ImageMagick, if your are using Ubuntu, these commands are useful.

sudo add-apt-repository ppa:dhor/myway
sudo apt-get update
sudo apt-get install graphicsmagick
sudo apt-get install imagemagick
like image 22
Isidro Martínez Avatar answered Oct 20 '22 22:10

Isidro Martínez


I had the same problem on windows! Maybe my answer will help someone!

If you use gm on windows you should download windows binaries here and add gm.exe to your windows environment PATH variable. After that you have to restart your PC. Then install corresponding node package with npm install gm and it will work! ;)

like image 8
Gh111 Avatar answered Oct 20 '22 20:10

Gh111