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?
Try brew install graphicsmagick
. Does that resolve the error you saw?
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
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! ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With