Skip to main content
Module

x/monke/mod.ts>Image

Color quantization and dithering in TypeScript.
Go to Latest
class Image
implements ImageData
Re-export
import { Image } from "https://deno.land/x/monke@v1.0.0/mod.ts";

Image with width, height, and pixel data

Constructors

new
Image(
pixels: Uint8ClampedArray,
width: number,
height?: number,
)

Properties

colorSpace: "sRGB"
readonly
data: Uint8ClampedArray
height: number
pixels: Color[]
width: number

Methods

blur(method: BlurType)

Blur the image. Currently only supports box blur.

dither(palette: Color[], options?: DitherOptions)

Recolor the image with dithering

grayscale(): void

Make the image grayscale

invert(): void

Invert colors in the image

map(fn: (c: Color) => Color): void

Apply a function on every pixel in the image

monochrome(dither?, ditherMode?: "floyd_steinberg" | "quick"): void

Recolor the image using just black and white

recolor(palette: Color[])

Recolor the image without dithering

Convert to an ImageData object