使用Node.js重采样图像 [英] Resampling images with Node.js

查看:109
本文介绍了使用Node.js重采样图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经对网络进行了彻底的搜索,但是还没有找到任何东西.

I have searched the net pretty thoroughly and have yet to find anything.

Node.js是否可以对图像进行重新采样,例如将800x600的图像变为400x300的图像,以获得更好的Web性能?

Is there a way with Node.js to resample images, for example, make a 800x600 image a 400x300 image for better web performance?

推荐答案

您需要获取 ImageMagick 安装在系统上,然后可以使用Node模块与之交互: https://github .com/rsms/node-imagemagick

You need to get ImageMagick installed on your system and then you can use a Node module to interact with it: https://github.com/rsms/node-imagemagick

对于在Node 0.4.x上的Ubuntu来说,它对我来说很好用,但是我还没有在最新的0.6.x上进行过测试.

It worked for me fine on Ubuntu with Node 0.4.x, I haven't tested with the latest 0.6.x though.

另一种替代方法(我尚未测试过,但我听说过很棒的东西)是 node-canvas .

Another alternative (which I haven't tested but I've heard great things about) is node-canvas.

这篇关于使用Node.js重采样图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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