node-vibrant
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -13,3 +13,3 @@ | ||
*/ | ||
var Image, Swatch, Vibrant, _, util, | ||
var Swatch, Vibrant, _, util, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -20,4 +20,2 @@ slice = [].slice; | ||
Image = require('./node-image'); | ||
_ = require('underscore'); | ||
@@ -88,3 +86,3 @@ | ||
var image; | ||
return image = new Image(this.sourceImage, (function(_this) { | ||
return image = new this.constructor.Image(this.sourceImage, (function(_this) { | ||
return function(err, image) { | ||
@@ -91,0 +89,0 @@ var error; |
{ | ||
"name": "node-vibrant", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Node.js port of vibrant.js. Get color variations from an image. Basically a JS port of Android's Palette", | ||
"main": "lib/vibrant.js", | ||
"main": "lib/index.js", | ||
"browser": "lib/browser.js", | ||
"directories": { | ||
@@ -15,2 +16,3 @@ "example": "examples" | ||
"devDependencies": { | ||
"browserify": "^10.2.4", | ||
"chai": "^3.0.0", | ||
@@ -21,4 +23,7 @@ "coffee-script": "^1.9.3", | ||
"gulp-coffee": "^2.3.1", | ||
"gulp-heap": "^1.1.0", | ||
"gulp-mocha": "^2.1.0" | ||
"gulp-heap": "^1.1.2", | ||
"gulp-mocha": "^2.1.0", | ||
"gulp-uglify": "^1.2.0", | ||
"vinyl-buffer": "^1.0.0", | ||
"vinyl-source-stream": "^1.1.0" | ||
}, | ||
@@ -25,0 +30,0 @@ "scripts": { |
@@ -6,4 +6,16 @@ # node-vibrant | ||
## Features | ||
* Identical (asynchronous) API for both node.js and browser environment | ||
* Support browserify | ||
* Consistent results (*) | ||
_* The results is consistent within each user's browser instance regardelss of visible region or display size of the image, unlike the original `vibrant.js` implementation._ | ||
_However, due to the very nature of HTML5 canvas element, image rendering is platform/machine-dependent. Thus the resulting swatches in browser environment varies and may not be the same as in node.js nor in another machine. See [Canvas Fingerprinting](https://en.wikipedia.org/wiki/Canvas_fingerprinting)._ | ||
## Install | ||
### node.js | ||
```bash | ||
@@ -15,3 +27,6 @@ $ npm install node-vibrant | ||
### node.js / browserify | ||
```coffee | ||
# Use in node.js or bunddle with browserify | ||
Vibrant = require('node-vibrant') | ||
@@ -24,2 +39,19 @@ | ||
### Browser | ||
```html | ||
<!-- Debug version --> | ||
<script src="/path/to/dist/vibrant.js"></script> | ||
<!-- Uglified version --> | ||
<script src="/path/to/dist/vibrant.min.js"></script> | ||
<script> | ||
// Use `Vibrant` in script | ||
// Vibrant is exported to global. window.Vibrant === Vibrant | ||
var v = new Vibrant('/path/to/image', opts); | ||
// ... same as in node.js | ||
</script> | ||
``` | ||
## References | ||
@@ -56,2 +88,9 @@ | ||
## Intentional Deviation From `vibrant.js` | ||
* `node-vibrant` takes image path, not the image object as parameter for the obvious reason that node.js environment has no access to HTML DOM object. | ||
* `node-vibrant` provides asynchronous API since most node.js image processing library is asynchronous. And the original `vibrant.js` workflow is asynchronous any way (though you will have to handle the image loading yourself, while `node-vibrant` does it for you). | ||
* `node-vibrant` uses one single `opts` object to hold all options for future expansions. And it feels more node.js-like. | ||
* `node-vibrant` uses method call to initiate image processing instead of constructor so that developers can use it with `Promise`. | ||
## Benchmark | ||
@@ -58,0 +97,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
595366
36
2668
119
11
2
4
3