node.js - NodeJs lwip.open() callback function returns empty object on reading a image file from disk -
lwip.open() returns empty object on reading image disk , using lwip version "0.0.6"
nodejs code:
var lwip = require('lwip'); lwip.open('path/to/image.jpg', function(err, image){ console.log("image :", image); });
output:
image : {__lwip: {}, __locked: false, __trans: false }
though callback function throws empty object {__lwip: {}, __locked: false, __trans: false }, write callback image location view image once complete image manipulation operations...
nodejs example code:
var lwip = require('lwip'); require('lwip').open('image.jpg', function(err, image){ image.batch() .scale(0.75) // scale 75% .rotate(45, 'white') // rotate 45degs clockwise (white fill) .crop(200, 200) // crop 200x200 square center .blur(5) // gaussian blur sd=5 .writefile('output.jpg', function(err){ // check err... // done. }); });
Comments
Post a Comment