pixel-change
Advanced tools
Comparing version 0.0.10 to 0.0.15
'use strict'; | ||
module.exports = require('./lib/pixel-change'); | ||
module.exports = require('node-gyp-build')(__dirname); |
{ | ||
"name": "pixel-change", | ||
"version": "0.0.10", | ||
"version": "0.0.15", | ||
"description": "Measure differences between 2 identically sized buffer arrays of gray, rgb, or rgba pixels.", | ||
"main": "index.js", | ||
"scripts": { | ||
"install": "node-gyp rebuild", | ||
"pretest": "npm install", | ||
"test": "node test/test && node test/test2 && node test/test3 && node test/test4 && node test/test5 && node test/js_vs_cpp && node test/js_vs_cpp2 && node test/js_vs_cpp3", | ||
"preversion": "npm test", | ||
"postversion": "npm run doc", | ||
"doc": "jsdoc lib/pixel-change.js -d docs && git commit -m 'update docs' -- docs", | ||
"local": "node test/local && node test/local2 && node test/local3", | ||
"compare": "node test/js_vs_cpp && node test/js_vs_cpp2 && node test/js_vs_cpp3", | ||
"regions": "node test/gray_regions && node test/rgb_regions && node test/rgba_regions" | ||
"test": "echo test", | ||
"prebuild": "prebuildify --target=node@ --napi=true", | ||
"download": "prebuildify-ci download", | ||
"install": "node-gyp-build" | ||
}, | ||
@@ -36,3 +31,8 @@ "repository": { | ||
"motion", | ||
"detection" | ||
"detection", | ||
"n-api", | ||
"napi", | ||
"c++", | ||
"cpp", | ||
"c plus plus" | ||
], | ||
@@ -46,18 +46,17 @@ "author": "Kevin Godell <kevin.godell@gmail.com>", | ||
"private": false, | ||
"gypfile": true, | ||
"files": [ | ||
"lib/", | ||
"src/", | ||
"binding.gyp" | ||
"binding.gyp", | ||
"src/*.cc", | ||
"src/*.h", | ||
"prebuilds" | ||
], | ||
"gypfile": true, | ||
"engines": { | ||
"node": ">=8.5" | ||
}, | ||
"dependencies": { | ||
"node-addon-api": "^1.2.0" | ||
"node-addon-api": "^1.6.3", | ||
"node-gyp-build": "^3.8.0" | ||
}, | ||
"devDependencies": { | ||
"pipe2pam": "^0.6.2", | ||
"polygon-points": "^0.5.1" | ||
"prebuildify": "^2.11.0", | ||
"prebuildify-ci": "^1.0.4" | ||
} | ||
} |
# pixel-change | ||
###### [![Build Status](https://travis-ci.org/kevinGodell/pixel-change.svg?branch=master)](https://travis-ci.org/kevinGodell/pixel-change) [![Build status](https://ci.appveyor.com/api/projects/status/fp7iei6tfdc9fqqy/branch/master?svg=true)](https://ci.appveyor.com/project/kevinGodell/pixel-change/branch/master) [![GitHub issues](https://img.shields.io/github/issues/kevinGodell/pixel-change.svg)](https://github.com/kevinGodell/pixel-change/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/kevinGodell/pixel-change/master/LICENSE) | ||
**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. | ||
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. | ||
## installation | ||
@@ -14,42 +12,2 @@ ``` | ||
``` | ||
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 | ||
}); | ||
see [pam-diff](https://github.com/kevinGodell/pam-diff) |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
1108573
20
2
1
12
7
+ Addednode-gyp-build@^3.8.0
+ Addednode-gyp-build@3.9.0(transitive)
Updatednode-addon-api@^1.6.3