Reputation: 2372
Any one tell me to how to get image information using NodeJs module 'gm' . Here i used below code for re-size. But if image is smaller than re-size size than does not re-size so, that i want validation for image width and height so that purpose i want to get 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);
}
});
Upvotes: 0
Views: 1497
Reputation: 1465
// output all available image properties
gm('/path/to/img.png')
.identify(function (err, data) {
if (!err) console.log(data)
});
Edit
If you want to know basic implementation of NodeJS packages, visit the npm website as it generally provides examples of the essential functions within the package: https://www.npmjs.org/package/gm
Upvotes: 2