Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@jimp/plugin-threshold
Advanced tools
@jimp/plugin-threshold is a plugin for the Jimp image processing library that allows you to apply threshold effects to images. This effect converts an image to black and white based on a threshold value, which can be useful for various image processing tasks such as edge detection, binarization, and more.
Apply Threshold Effect
This feature allows you to apply a threshold effect to an image. The `max` parameter specifies the threshold value. Pixels with a value above this threshold will be set to white, and those below will be set to black.
const Jimp = require('jimp');
Jimp.read('path/to/image.jpg')
.then(image => {
image.threshold({ max: 128 })
.write('path/to/output.jpg');
})
.catch(err => {
console.error(err);
});
Sharp is a high-performance image processing library that supports a wide range of image transformations, including thresholding. It is known for its speed and efficiency, especially with large images.
GraphicsMagick (gm) is a powerful image processing library that provides a wide range of image manipulation features, including thresholding. It is a wrapper around the GraphicsMagick command-line tool and is known for its robustness and versatility.
opencv4nodejs is a Node.js binding for OpenCV, a popular computer vision library. It provides extensive image processing capabilities, including thresholding, and is suitable for more advanced image analysis tasks.
Lightens an image.
This is useful as a simplified method for processing scanned drawings, signatures, etc
import jimp from 'jimp';
async function main() {
const image = await jimp.read('test/image.png');
image.threshold({ max: 150 });
// or
image.threshold({ max: 200, replace: 200, autoGreyscale: false });
}
main();
FAQs
Unknown package
The npm package @jimp/plugin-threshold receives a total of 935,732 weekly downloads. As such, @jimp/plugin-threshold popularity was classified as popular.
We found that @jimp/plugin-threshold demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.