以指定格式编码当前图像到Buffer,config为图片设置,目前支持设置JPG图像质量
Return buffer
返回填充好的Buffer
Note:The operation will cut off the chain
注意:该操作将会切断调用链
See:.save(file[, type[, config]]) 参考:.save(file[, type[, config]])
.save(file[, type[, config]])
eg:images(“input.png”).encode(“output.jpg”, {operation:50}) Encoding and save the current image to a file, if the type is not specified, type well be automatically determined according to the file, config is image setting. eg: { operation:50 }
编码并保存当前图像到 file ,如果type未指定,则根据 file 自动判断文件类型,config为图片设置,目前支持设置JPG图像质量
.size([width[, height]])
Get size of the image or set the size of the image,if the height is not specified, then scaling based on the current width and height获取或者设置图像宽高,如果height未指定,则根据当前宽高等比缩放
.resize(width[, height])
Set the size of the image,if the height is not specified, then scaling based on the current width and height
设置图像宽高,如果height未指定,则根据当前宽高等比缩放, 默认采用 bicubic 算法。
.width([width])
Get width for the image or set width of the image获取或设置图像宽度
.height([height])
Get height for the image or set height of the image获取或设置图像高度
images.setLimit(width, height)
Set the limit size of each image 设置库处理图片的大小限制,设置后对所有新的操作生效(如果超限则抛出异常)
images.setGCThreshold(value)
Set the garbage collection threshold 设置图像处理库自动gc的阈值(当新增内存使用超过该阈值时,执行垃圾回收)
images.getUsedMemory()
Get used memory (in bytes)得到图像处理库占用的内存大小(单位为字节)
images.gc()
Forced call garbage collection 强制调用V8的垃圾回收机制
https://github.com/zhangyuanwei/node-images









