@types/quantize
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/quantize

Summary

This package contains type definitions for quantize (https://github.com/olivierlesnicki/quantize).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/quantize.

index.d.ts

declare namespace quantize {
    type RgbPixel = [number, number, number];

    interface PriorityQueue {
        debug: () => ColorObject[];
        map: <U>(callback: (item: ColorObject, index: number) => U) => U[];
        peek: (index?: number) => ColorObject;
        pop: () => ColorObject;
        push: (item: ColorObject) => void;
        size: () => number;
    }

    interface VBox {
        r1: number;
        r2: number;
        g1: number;
        g2: number;
        b1: number;
        b2: number;
        histo: number[];

        avg: (recalculate?: boolean) => RgbPixel;
        contains: (pixel: RgbPixel) => boolean;
        copy: () => VBox;
        count: () => number;
        volume: (recalculate?: boolean) => number;
    }

    interface ColorObject {
        color: RgbPixel;
        vbox: VBox;
    }

    interface ColorMap {
        vboxes: PriorityQueue;

        /**
         * Maps the pixel from source image to the closest palette color
         */
        map: (pixel: RgbPixel) => RgbPixel;
        nearest: (pixel: RgbPixel) => RgbPixel;
        /**
         * Returns the palette as an array of RgbPixel
         * @returns RgbPixel[][]
         */
        palette: () => RgbPixel[];
        push: (vbox: VBox) => void;
        /**
         * Returns the size of the palette
         */
        size: () => number;
    }
}

declare function quantize(pixels: quantize.RgbPixel[], colorCount: number): quantize.ColorMap | false;

export = quantize;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by matiand.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.21,930ts5.6
1.0.21,930latest
1.0.21,930ts4.5
1.0.21,930ts4.6
1.0.21,930ts4.7
1.0.21,930ts4.8
1.0.21,930ts4.9
1.0.21,930ts5.0
1.0.21,930ts5.1
1.0.21,930ts5.2
1.0.21,930ts5.3
1.0.21,930ts5.4
1.0.21,930ts5.5
1.0.21,930ts5.7
1.0.0496ts4.3
1.0.0496ts4.4

Version History

VersionDownloads (Last 7 Days)Published
1.0.21,930
1.0.194
1.0.0496

Package Sidebar

Install

npm i @types/quantize

Weekly Downloads

1,449

Version

1.0.2

License

MIT

Unpacked Size

5.5 kB

Total Files

5

Last publish

Collaborators

  • types