Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-vibrant

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-vibrant - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

dist/vibrant.js

6

lib/vibrant.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc