mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-18 03:29:17 +00:00
* lol zx quant * Adding ZX option * Improving colour selection so we don't end up with the same colour twice. Also fixing a bug with the colour conflict resolution. * Putting it behind a konami code * Better comments * Adding comment * Removing unnecessary malloc.
19 lines
428 B
TypeScript
19 lines
428 B
TypeScript
import QuantizerWorker from './Quantizer.worker';
|
|
|
|
export async function quantize(data: ImageData, opts: QuantizeOptions): Promise<ImageData> {
|
|
const quantizer = await new QuantizerWorker();
|
|
return quantizer.quantize(data, opts);
|
|
}
|
|
|
|
export interface QuantizeOptions {
|
|
zx: number;
|
|
maxNumColors: number;
|
|
dither: number;
|
|
}
|
|
|
|
export const defaultOptions: QuantizeOptions = {
|
|
zx: 0,
|
|
maxNumColors: 256,
|
|
dither: 1.0,
|
|
};
|