Package Exports
- quantize-colors
- quantize-colors/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (quantize-colors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.