最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - gm conversion issue in node.js - Stack Overflow

programmeradmin3浏览0评论

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?

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?

Share Improve this question edited Jul 7, 2015 at 13:00 08Dc91wk 4,3188 gold badges36 silver badges68 bronze badges asked Jul 3, 2015 at 22:09 JN_newbieJN_newbie 6,06216 gold badges69 silver badges105 bronze badges
Add a comment  | 

9 Answers 9

Reset to default 23

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! ;)

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

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.

Just try with below command and it will solve your problem

  • sudo apt install graphicsmagick

When installing ImageMagick from https://imagemagick.org/script/download.php, be sure to check the option to "Install legacy utilities (convert)".

Opensuse

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

There few steps to solve this error.

  1. Confirm the GraphicsMagick is installed in your user in the terminal.

  2. $ gm

  3. $ sudo gm //Command Line Screenshot

  4. 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.

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.

发布评论

评论列表(0)

  1. 暂无评论