需要nodejs对图片进行操作,主要包括:
裁剪 压缩 甚至获得图片所有像素的像素值等...
在网上找的话看着有不少,但不知道用着都怎么样
不知道有没有什么比较好的图片操作库?
还是说原生写比较好?
(表达能力不很强..希望经验人士指点一二
PHP中文网2017-04-17 15:05:42
The function of uploading images to generate thumbnails has been implemented using gm. You can refer to this library, but your server must be pre-installed with GraphicsMagick or ImageMagick.
http://aheckmann.github.io/gm/
高洛峰2017-04-17 15:05:42
I have had related needs when using NW.js as a client before. I have found some implementations and experienced them myself. Let me give you recommendations for the two situations.
If it is pure Node.js, I recommend a domestic images library https://github.com/zhangyuanw... It imitates JQ syntax, Chinese documentation, and does not rely on other image processing libraries.
If you are using NW.js or Electron, which can use canvas, I recommend using canvas directly to implement it. You can take screenshots, pick colors, get the pixel values of all pixels, etc., and it is easy to transplant