
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Measure differences between pixel arrays extracted from pam images. Works well with node module pipe2pam to extract pam images from an ffmpeg pipe. Supported tupltypes are rgb, rgb_alpha, and grayscale. It is currently being used for a video motion detection project.
npm install pam-diff --save
const pamDiff = new PamDiff({ difference: 5, percent: 5 });
const region1 = {
name: 'region1',
difference: 12,
percent: 22,
polygon: [
{ x: 0, y: 0 },
{ x: 0, y: 225 },
{ x: 100, y: 225 },
{ x: 100, y: 0 },
],
};
const region2 = {
name: 'region2',
difference: 14,
percent: 10,
polygon: [
{ x: 100, y: 0 },
{ x: 100, y: 225 },
{ x: 200, y: 225 },
{ x: 200, y: 0 },
],
};
const regions = [region1, region2];
const pamDiff = new PamDiff({ regions: regions });
difference
and percent
of the individual region is ignored. Set a global value.const region1 = {
name: 'region1',
polygon: [
{ x: 0, y: 0 },
{ x: 0, y: 225 },
{ x: 100, y: 225 },
{ x: 100, y: 0 },
],
};
const region2 = {
name: 'region2',
polygon: [
{ x: 100, y: 0 },
{ x: 100, y: 225 },
{ x: 200, y: 225 },
{ x: 200, y: 0 },
],
};
const regions = [region1, region2];
const pamDiff = new PamDiff({ difference: 12, percent: 10, mask: true, regions: regions });
event
pamDiff.on('diff', data => {
console.log(data);
});
callback
/* callback function */
function myCallback(data) {
console.log(data);
}
/* via the constructor */
const pamDiff = new pamDiff({ difference: 10, percent: 20 }, myCallback);
/* via the setter */
pamDiff.callback = myCallback;
/* via the chain-able setter */
pamDiff.setCallback(myCallback).setDifference(10).setPercent(20);
/* remove the callback */
pamDiff.callback = null;
When targeting all pixels:
{
trigger: [
{ name: 'all', percent: 13 }
],
pam: <Buffer>,
headers: <Buffer>,
pixels: <Buffer>
}
When targeting regions of pixels:
{
trigger: [
{ name: 'region1', percent: 13 },
{ name: 'region2', percent: 22 }
],
pam: <Buffer>,
headers: <Buffer>,
pixels: <Buffer>
}
When targeting all pixels ignored by mask:
{
trigger: [
{ name: 'mask', percent: 13 }
],
pam: <Buffer>,
headers: <Buffer>,
pixels: <Buffer>
}
When targeting all pixels and setting {response: "bounds"}:
{
trigger: [
{ name: 'all', percent: 13, minX: 42, maxX: 399, minY: 113, maxY: 198 }
],
pam: <Buffer>,
headers: <Buffer>,
pixels: <Buffer>
}
When targeting all pixels and setting {response: "blobs"}:
{
trigger: [
{
name: "all",
percent: 9,
minX: 137,
maxX: 1782,
minY: 392,
maxY: 695,
blobs: [
{
label: 0,
percent: 3,
minX: 1192,
maxX: 1486,
minY: 392,
maxY: 695
},
{
label: 1,
percent: 3,
minX: 1488,
maxX: 1782,
minY: 392,
maxY: 695
}
]
}
],
pam: <Buffer>,
headers: <Buffer>,
pixels: <Buffer>
}
FAQs
Measure differences between pixel arrays extracted from pam images
The npm package pam-diff receives a total of 3,070 weekly downloads. As such, pam-diff popularity was classified as popular.
We found that pam-diff 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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.