0

lwip.open() 在从磁盘读取图像时返回一个空对象,并且正在使用 lwip 版本“0.0.6”

Node.js 代码:

var lwip = require('lwip');
lwip.open('path/to/image.jpg', function(err, image){
 console.log("Image :", image); 
});

输出:

图片:{__lwip: {}, __locked: false, __trans: false }

4

1 回答 1

0

虽然回调函数会抛出一个空对象 {__lwip: {}, __locked: false, __trans: false },但一旦完成图像操作操作,将回调图像写入一个位置以查看图像......

NodeJs 示例代码:

var lwip = require('lwip');    
require('lwip').open('image.jpg', function(err, image){          
  image.batch()
    .scale(0.75)          // scale to 75%
    .rotate(45, 'white')  // rotate 45degs clockwise (white fill)
    .crop(200, 200)       // crop a 200X200 square from center
    .blur(5)              // Gaussian blur with SD=5
    .writeFile('output.jpg', function(err){
      // check err...
      // done.
    });    
});
于 2015-05-08T13:02:01.430 回答