node-image-compressor

1.0.9 • Public • Published

npm install compressor --save

⚠️⚠️⚠️⚠️ this module required imageMagic to be installed on your os install imageMagick https://imagemagick.org/script/download.php

##USAGE

let compressor = new Compressor({
    input : "my_big_image_file.jpg",
    output : "my_compressed_file_path.jpg",
    size : "200x200",
    quality : 85,
    logging : true,
})

compressor.compress((err)=>{
    if (!err) console.log("image compressed")
}); //compress image

##API

let compressor  = new Compressor({
    input : "my_big_image_file.jpg",
    output : "my_compressed_file_path.jpg",
    size : "200x200",
    quality : 85,
    logging : true,
})

//Params:filePath: String (default is input image)
//Returns:{is_landscape: boolean, is_square: boolean, width: number, is_portrait: boolean, height: number}
compressor.getImageDimensions(filePath);

//Params:filePath: String
//Returns:boolean
compressor.isPortrait(filePath);

//Params:filePath: String
//Returns:boolean
compressor.isSquare(filePath);

//Params:filePath: String
//Returns:boolean
compressor.isLandscape(filePath)

Package Sidebar

Install

npm i node-image-compressor

Weekly Downloads

16

Version

1.0.9

License

ISC

Unpacked Size

8.12 kB

Total Files

3

Last publish

Collaborators

  • inorainllc