blurry-detector
v1.0.2
Published
A Node.js utility to assess image sharpness using Laplacian variance, complete with a CLI tool.
Downloads
102
Maintainers
Readme
blurry-detector 📸
A user-friendly Node.js utility to detect blurriness in images using the Laplacian variance method. Works as a CLI and as class.
Introduction
Ever had that perfect image ruined by a slight blur? blurry-detector
is here to the rescue! Using the Laplacian variance method, this package provides an intuitive way to assess the sharpness of your images.
Installation
You can easily install blurry-detector
using npm:
npm i -g blurry-detector
Usage
First, import the 'BlurryDetector' class:
const BlurryDetector = require('blurry-detector');
You can then instantiate the detector and check an image:
const detector = new BlurryDetector();
detector.isImageBlurry('path-to-your-image.jpg').then(isBlurry => {
if (isBlurry) {
console.log('The image is blurred!');
} else {
console.log('The image is sharp!');
}
});
Customization
By default, the blurriness threshold is set to 300. If you wish to use a different threshold, simply pass it when instantiating the detector:
const detector = new BlurryDetector(250); // using a custom threshold
CLI Usage
The package also comes with a handy CLI tool:
blurry-detector path-to-your-image.jpg
Contribution
Your contributions and suggestions are heartily ♡ welcome. (✿◠‿◠)