
Research
Security News
Malicious npm Package Wipes Codebases with Remote Trigger
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
fast-average-color-node
Advanced tools
A simple library that calculates the average color of images in Node.js.
A simple library that calculates the average color of any images for Node.js.
jpeg
png
webp
gif
svg
npm i --save fast-average-color-node
import { getAverageColor } from 'fast-average-color-node';
getAverageColor('./image.png').then(color => {
console.log(color);
});
or
import { getAverageColor } from 'fast-average-color-node';
async function printAverageColor() {
const color = await getAverageColor('./image.png');
console.log(color);
};
printAverageColor();
getAverageColor(filename, options)
/**
* @param {string | Buffer} [filename] filename, url, Buffer or data64 string
* @param {Object} [options]
* @param {number[]} [options.defaultColor=[0, 0, 0, 0]]
* @param {number[]} [options.ignoredColor] [red (0-255), green (0-255), blue (0-255), alpha (0-255)]
* @param {string} [options.mode="speed"] "precision" or "speed"
* @param {string} [options.algorithm="sqrt"] "simple", "sqrt" or "dominant"
* @param {number} [options.step=1]
* @param {number} [options.left=0]
* @param {number} [options.top=0]
* @param {number} [options.width=width of resource]
* @param {number} [options.height=height of resource]
* @param {boolean} [options.silent] Disable error output via console.error
*/
The promise with value.
/**
* @param {Object} [color]
* @param {string} [color.rgb]
* @param {string} [color.rgba]
* @param {string} [color.hex]
* @param {string} [color.hexa]
* @param {boolean} [color.isDark]
* @param {boolean} [color.isLight]
* @param {number[]} [color.value]
* @param {Error} [color.error]
*/
MIT License
FAQs
A simple library that calculates the average color of images in Node.js.
The npm package fast-average-color-node receives a total of 4,904 weekly downloads. As such, fast-average-color-node popularity was classified as popular.
We found that fast-average-color-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.
Security News
New CNA status enables OpenJS Foundation to assign CVEs for security vulnerabilities in projects like ESLint, Fastify, Electron, and others, while leaving disclosure responsibility with individual maintainers.