Histogram
Provides a histogram data structure from PNG, JPEG or GIF files using canvas.
This library works in nodejs and in any canvas supporting browser using histogram.min.js.
In the browser histogram will be available in window.histogram
You can also use require.js instead, keeping your global scope clean.
Example usage
NodeJS
var histogram = ;;
Browser with require.js
;
Vanilla browser
Data structure
red: 256 // Count of the number of times a value appears in the red channelgreen: 256 // Count of the number of times a value appears in the green channelblue: 256 // Count of the number of times a value appears in the blue channelalpha: 256 // Count of the number of times a value appears in the alpha channelcolors:rgb: 0 // Number of unique RGB colorsrgba: 0 // Number of unique RGBA colorspalettes:rgb: // Array of unique colors in hex notationrgba: // Array of unique colors in hexa notationgreyscale: true // Indicates whether all colors are greyscale or notalphachannel: false // Indicates that one or more pixels are translucent
License
This software is licensed under the beerware license. Do whatever you want with it. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.