gm conversion issue in node.js

JN_newbie picture JN_newbie · Jul 4, 2015 · Viewed 13.2k times · Source

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?

Answer

Isidro Martínez picture Isidro Martínez · Apr 20, 2016

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