Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/monke/src/mod.ts

Color quantization and dithering in TypeScript.
Latest
import * as monke from "https://deno.land/x/monke@v1.0.2/src/mod.ts";

Classes

General class for RGBA colors

Histogram of colors with reduced space Effectively quantizes the image into 32768 colors

Image with width, height, and pixel data All methods mutate the image itself

Functions

Dither the image into a smaller palette Starts from the mid point of the image I have no idea why I did this

Dither the image into a smaller palette Very fast dithering Use twoRowSierra for more accuracy Use monochromeFs for monochrome dithering

Get a histogram of frequency of colors.

Dither the image into monochrome Uses Floyd-Steinberg matrix

Dither the image into monochrome Uses the same matrix as above

Dither the image into a smaller palette Uses a quick, two-row dither. Creates a column pattern. Use Floyd-Steinberg or Sierra to avoid patterns.

Dither the image into a smaller palette Uses two-row Sierra matrix

Dither the image into a smaller palette Uses Sierra lite matrix Use twoRowSierraDither for more accuracy