Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
pixel-change
Advanced tools
Measure differences between 2 identically sized buffer arrays of gray, rgb, or rgba pixels.
EXPERIMENTAL. FIRST ATTEMPT AT USING N-API WHICH IS ONLY SUPPORTED ON NODE 8.5 AND UP
Measure differences between 2 identically sized buffer arrays of gray, rgb, or rgba pixels. Backed by c++ libraries iterating pixel buffers, converting to grayscale, measuring differences, and reporting back the percent of pixels that have changed.
npm install pixel-change
const PixelChange = require('pixel-change');
/* -- access static methods -- */
//will return a percent of how many gray pixels are changed between the 2 buffer pixel arrays
const percent = PixelChange.compareGrayPixels(width, height, diff, buffer1, buffer2);
//will return a percent of how many rgb pixels are changed between the 2 buffer pixel arrays
const percent = PixelChange.compareRgbPixels(width, height, diff, buffer1, buffer2);
//will return a percent of how many rgba pixels are changed between the 2 buffer pixel arrays
const percent = PixelChange.compareRgbaPixels(width, height, diff, buffer1, buffer2);
/* -- access instance methods -- */
//create a new instance to access convenience methods
const pc = new PixelChange({width: 1920, height: 1080, depth: 3, diff: 25, percent: 12});
//listen to change event when percent of different pixels is detected
pc.on('change', (percent)=>{
//do something when change event is dispatched because of percent
});
//compare 2 buffers, will dispatch event if change is detected
pc.compare(buffer1, buffer2);
//alternate convenience method, keep feeding pixel buffer via push
//instance will cache previous buffer to compare with next one pushed
pc.push(buffer);
/* -- alternative to listening to "change" event
//pass callback to new instance
const pc = new PixelChange({width: 1920, height: 1080, depth: 3, diff: 25, percent: 12}, (err, percent)=>{
if (err) {
throw err;
}
//do something when callback is called with percent
});
FAQs
Measure differences between 2 identically sized buffer arrays of gray, rgb, or rgba pixels.
The npm package pixel-change receives a total of 957 weekly downloads. As such, pixel-change popularity was classified as not popular.
We found that pixel-change demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.