node.js中的gm转换问题 [英] gm conversion issue in node.js

查看:61
本文介绍了node.js中的gm转换问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图像从jpg转换为png,但出现错误.下面是代码和错误.

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.')}
    })

错误是:

[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]

我必须要npm graphicsmagick和imagemagick吗?

Do I have to npm graphicsmagick and imagemagick?

推荐答案

可能graphicsmagick/imagemagick未正确安装,下载ImageMagick (如果您使用的是Ubuntu),这些命令很有用.

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

这篇关于node.js中的gm转换问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆