Reputation: 6072
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?
Upvotes: 12
Views: 20342
Reputation: 1051
GraphicsMagick Windows Installation
step 1:
choco install graphicsmagick
Follow this doc to install Chocolatey on windows :)
step 2:
go to graphicsmagick installation location.
Ex: C:\Program Files\GraphicsMagick-1.3.36-Q8
step 3:
add gm.exe location to your windows environment PATH variable
Ex: C:\Program Files\GraphicsMagick-1.3.36-Q8
setp 4:
open a new terminal (command prompt/ powershell)
run gm.exe
if you get 'gm.exe unable to start correctly' error, install the VS2008 package from this page
step 5:
test the installation
Select "Command Prompt" from the Windows Start menu. Within the window type
gm convert logo: logo.miff
gm convert logo.miff win:
and the GraphicsMagick logo should be displayed in a window.
Upvotes: 0
Reputation: 41
Just try with below command and it will solve your problem
Upvotes: 1
Reputation: 1
There few steps to solve this error.
Confirm the GraphicsMagick is installed in your user in the terminal.
$ gm
$ sudo gm //Command Line Screenshot
Both "gm" and "sudo gm" commands should return the most of the time server running in the sudo user and we might have installed this in normal user so that Sudo user don't know the about installed package configure in the normal user. In short, make sure code running in sudo user then same mode GraphicsMagick should be available.
If did not got the above and got something like "command not found in the terminal" then use this link. https://www.tecmint.com/graphicsmagick-image-processing-cli-tool-for-linux/
also check the this link contains only command package might not available to download so https://sourceforge.net/projects/graphicsmagick/files/graphicsmagick/ change the version in the download link of the wget and follow the steps in above link.
Upvotes: 0
Reputation: 492
If you are developing on OpenSuse OS this issue can arise as well. To solve, you need to install the ImageMagick and GraphicsMagick packages:
sudo zypper install ImageMagick GraphicsMagick
Upvotes: 0
Reputation: 856
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
Upvotes: 23
Reputation: 1452
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! ;)
Upvotes: 10
Reputation: 121
When installing ImageMagick from https://imagemagick.org/script/download.php, be sure to check the option to "Install legacy utilities (convert)".
Upvotes: 0
Reputation: 6072
I have got it resolved by installing graphicsmagick and imagemagick and its path in environment variable will be automatically set out. Then I have to restart the windows to reflect the changes and now I can successfully converts and image.
Upvotes: 5