quantize-colors

1.0.2 • Public • Published

quantize-colors

quantize-colors is a lightweight and flexible Node.js package designed to simplify color quantization for image processing. The package provides functions for quantizing RGB colors, getting dominant color and building color palettes.

Features

  • Color Quantization: Efficiently reduce the number of colors in an image while preserving visual fidelity.
  • Dominant Color: Get the dominant color of the provided image.
  • Palette Building: Generate color palettes based on luminance, creating visually appealing sets of colors.

Installation

Install quantize-colors using npm:

npm install quantize-colors

Usage

const quantizeColors = require('quantize-colors');

// Example: Get the quantized colors of an image
const imageUrl = 'path/to/your/image.jpg';
quantizeColors.getQuantizedColors(imageUrl)
    .then((quantizedColors) => {
        console.log(quantizedColors);
    })
    .catch((err) => {
        console.error(err);
    });

// Example: Get the color palette of an image
quantizeColors.getColorPalette(imageUrl)
    .then((colorPalette) => {
        console.log(colorPalette);
    })
    .catch((err) => {
        console.error(err);
    });

// Example: Get the dominant color of an image
quantizeColors.getDominantColor(imageUrl)
    .then((dominantColor) => {
        console.log(dominantColor);
    })
    .catch((err) => {
        console.error(err);
    });

Visit the GitHub repository for detailed documentation and code examples.

License

This package is distributed under the ISC License.

Package Sidebar

Install

npm i quantize-colors

Weekly Downloads

3

Version

1.0.2

License

ISC

Unpacked Size

10.9 kB

Total Files

5

Last publish

Collaborators

  • devritobangoswami