1.0.7 • Published 5 years ago
convert-to-thumbnail v1.0.7
convert-to-thumbnail
convert-to-thumbnail is npm module and tool, used to convert images(png,jpg,jpeg) to thumbnail which is smae in image retio and small size for easy accessing
#Requirment
- source directory containing image file
- destination directry
Features!
- provide source and destination directory
Plugins
convert-to-thumbnail is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.
Plugin | README |
---|---|
jimp | https://www.npmjs.com/package/jimp |
image-size | https://www.npmjs.com/package/image-size |
fs | https://www.npmjs.com/package/fs |
Installation
$npm install --save convert-to-thumbnail
how to use
##convert directory contained images
var convertor = require('convert-to-thumbnail');
let dirSorcePath = __dirname+'/public/';
let dirDestPath = __dirname+'/converted/';
convertor.convertToThumbnail(dirSorcePath,dirDestPath)
.then(v =>{console.log("Successfully converting wait...once convert then only end this programm")})
.catch(err => console.error(err))
##convert single images
var convertor = require('convert-to-thumbnail');
let fileSorcePath = __dirname+'/public/IMG_20180916_172642057.jpg'
let fileDestPath = __dirname+'/converted/IMG_20180916_172642057.jpg'
convertor.convertImageToThumbnail(fileSorcePath,fileDestPath)
.then(v =>{console.log("Successfully converting wait...once convert then only end this program")})
.catch(err => console.error(err))
contribute
Want to contribute? Great! please mail to prathmeshn007@gmail.com with subject
"npm contribution convert-to-thumbnail"