quantize

WebJar for quantize

License

License

MIT
Categories

Categories

Ant Build Tools
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

quantize
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

quantize
WebJar for quantize
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/olivierlesnicki/quantize

Download quantize

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/quantize/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>quantize</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/quantize/
implementation 'org.webjars.npm:quantize:1.0.2'
// https://jarcasting.com/artifacts/org.webjars.npm/quantize/
implementation ("org.webjars.npm:quantize:1.0.2")
'org.webjars.npm:quantize:jar:1.0.2'
<dependency org="org.webjars.npm" name="quantize" rev="1.0.2">
  <artifact name="quantize" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='quantize', version='1.0.2')
)
libraryDependencies += "org.webjars.npm" % "quantize" % "1.0.2"
[org.webjars.npm/quantize "1.0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

quantize

Node.js module for color quantization, based on Leptonica.

Install

npm install quantize

Quick Overview

Usage

var quantize = require('quantize');

var arrayOfPixels = [[190,197,190], [202,204,200], [207,214,210], [211,214,211], [205,207,207]];
var maximumColorCount = 4;

var colorMap = quantize(arrayOfPixels, maximumColorCount);
  • arrayOfPixels - An array of pixels (represented as [R,G,B arrays]) to quantize
  • maxiumColorCount - The maximum number of colours allowed in the reduced palette
Reduced Palette

The .palette() method returns an array that contains the reduced color palette.

// Returns the reduced palette
colorMap.palette(); 
// [[204, 204, 204], [208,212,212], [188,196,188], [212,204,196]]
Reduced pixel

The .map(pixel) method maps an individual pixel to the reduced color palette.

// Returns the reduced pixel
colorMap.map(arrayOfPixels[0]);
// [188,196,188]

Author

Contributors

License

Licensed under the MIT License.

Versions

Version
1.0.2