Colourless
This module limits colors in images. There are features to give maximum colors count or list of color codes.
Currently supports: .jpg
LIVE DEMO
Installing
Just install using NPM
npm install --save colourless
Getting Started
Below there are examples how to use this module in different ways:
Example 1: Limit colors count
const Colourless = ;const colourless = 'images/wolf.jpg';const buffer = await colourless;fs;
Example 2: Choose allowed colors
let buffer;// pass rgb arraybuffer = await colourless;// OR pass hex valuesbuffer = await colourless;
Example 3: Different input types
const Colourless = ;let colourless;// Image file pathcolourless= 'images/wolf.jpg';// base64 inputcolourless= 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAE...';// buffer as an imputcolourless= imageBuffer;
API
Colourless([path|base64|buffer])
-
.limitColorsCount(options)
- options.allowedColorsCount number of allowed colors (min: 2)
returns buffer of modified image
-
.setColors(options)
- options.colors array of allowed colors in RGB or HEX formats (min: 2)
returns buffer of modified image
License
This project is licensed under the MIT License - see the LICENSE file for details