npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rgbanalyse

v0.1.11

Published

A pure javascript image analysis library for generating RGB/H(SL)C histogram information

Downloads

5

Readme

RGBAnalyse

An RGB-HC histogram library for same-origin images

demonstrator gh-page: http://pomax.github.io/RGBAnalyse

Client-side installation: simply grab the library from the release directory on github, or use bower to install: bower install rgbanalyse.

Node package installation: npm install rgbanalyse.

API

The library sets up an object with the following properties/functions:

  • defaults - a settings object with default values as analysis options.
  • analyse(img,[options]) - performs image analysis on an image element, with optional tweaks.
  • computeHSL(R,G,B) - convert RGB to HSL (note this requires normalised RGB values).
  • computeRGB(H) - convert HSL (no S/L right now) to RGB, H in range [0,6.28].
  • analyse(img,[options]) - convert HSL to rgb (plain {r,g,b}, using range [0,255]).

The defaults object can be set prior to running analyses, and currently supports the following properties:

  • neutrals - 10 - integer from 0 to 255, indicating the how close together {r,g,b} coordinates must be to be considered neutral
  • smoothing - 5 - used to smooth the hue spectrum when determining dominant hues. (value is distance from mean)
  • distance - 10 - minimum distance between recording two hues to end up recorded as major hues (value can range from 0 to 628)

The analyse function returns a two property object. The first is the analysis property, which houses:

  • rgb - A 3 component object with the histographical data for r, g and b.
  • RGB - A 3 component object with the histographical data for R, G,a nd B.
  • hsl - An object with the histographical data for h, and .dominant, a sorted array of {H,strength} major hues.
  • average - the weighted averages for r, g, b, R, G, B, and h.
  • maxima - the absolute maxima for r, g, b, R, G, B, and h.

The second is the visualization property, available only when using the libary in the browser, which houses image source data-uris for:

  • histogram - a 256 x 256 combined rgb histogram
  • spectrum.histogram - a 360 x 200 hues histogram
  • spectrum.spectogram - a 360 x 50 spectrogram

LICNSE

This code is released as Public Domain code. In jurisdictions that do not recognise the public domain, this code is to be considered under an MIT license (http://opensource.org/licenses/MIT)