0.13.1 • Published 2 years ago

imagecolors v0.13.1

Weekly downloads
728
License
MIT
Repository
github
Last release
2 years ago

Image Colors

Use a combination of color quantization algorithms and human fiddling to get human perceivable colors out of an image.

Install

This module depends on ImageMagick and requires Node.js 12+ (tested on 12, 14, and 16).

[~] brew install imagemagick
[~] npm i imagecolors

Usage

const imageColors = require('imagecolors');
async function example() {
	const extracted = await imageColors.extract('./photo.jpg', 8);
	const converted = await imageColors.convert(colors, './palette.json');
	console.log({ extracted, converted });
}
example();

Note: There are working examples in the /examples folder.

Format

Returned color objects look like this:

[{
    pixels      : 208781,
    hex         : '#F0F0DC',
    labelHex    : '#444444',
    rgb         : { r: 240, g: 240, b: 220 },
    hsv         : { h: 60, s: 8, v: 94 },
    hsl         : { h: 60, s: 40, l: 90 },
    luminance   : '0.94',
    cmyk        : { c: 0, m: 0, y: 8, k: 6 },
    percent     : 10.07,
    family      : 'yellow'
}]

License

This software library is licensed under the MIT License.

0.13.1

2 years ago

0.13.0

3 years ago

0.12.1

3 years ago

0.12.0

4 years ago

0.11.0

6 years ago

0.10.7

6 years ago

0.10.5

10 years ago

0.10.2

10 years ago

0.6.3

11 years ago

0.6.2

11 years ago

0.6.1

11 years ago

0.6.0

11 years ago