node.js - NodeJS gm model use to get information of image? -
any 1 tell me how image information using nodejs module 'gm' . here used below code re-size. if image smaller re-size size not re-size so, want validation image width , height purpose want image information.
gm(main_url_path) .resize(size, size) .write(compress_path, function (err){ if(!err){ callback(compress_path); }else{ console.log("not compressed success !!"+err); callback(null); } });
// output available image properties gm('/path/to/img.png') .identify(function (err, data) { if (!err) console.log(data) });
edit
if want know basic implementation of nodejs packages, visit npm website provides examples of essential functions within package: https://www.npmjs.org/package/gm
Comments
Post a Comment