mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-12 00:37:19 +00:00
* Refactoring codecs * Plugging in new processor * Fixing decorator * MozJPEG free issue * Better worker aborting, and terminate workers that aren't used for 10 seconds * Better comment * Ooops, half-typed comment * Uncommenting problematic line * Surma fixed it! * Abstracting WASM initialisation * Better comment * Don't need this. * Adding ticket * noInitalRun * Reverting MozJPEG issue demo * Making a const for worker timeout * Inline docs * Bail early rather than nesting * Addressing nits
42 lines
950 B
TypeScript
42 lines
950 B
TypeScript
export enum MozJpegColorSpace {
|
|
GRAYSCALE = 1,
|
|
RGB,
|
|
YCbCr,
|
|
}
|
|
|
|
export interface EncodeOptions {
|
|
quality: number;
|
|
baseline: boolean;
|
|
arithmetic: boolean;
|
|
progressive: boolean;
|
|
optimize_coding: boolean;
|
|
smoothing: number;
|
|
color_space: MozJpegColorSpace;
|
|
quant_table: number;
|
|
trellis_multipass: boolean;
|
|
trellis_opt_zero: boolean;
|
|
trellis_opt_table: boolean;
|
|
trellis_loops: number;
|
|
}
|
|
|
|
export interface EncoderState { type: typeof type; options: EncodeOptions; }
|
|
|
|
export const type = 'mozjpeg';
|
|
export const label = 'MozJPEG';
|
|
export const mimeType = 'image/jpeg';
|
|
export const extension = 'jpg';
|
|
export const defaultOptions: EncodeOptions = {
|
|
quality: 75,
|
|
baseline: false,
|
|
arithmetic: false,
|
|
progressive: true,
|
|
optimize_coding: true,
|
|
smoothing: 0,
|
|
color_space: MozJpegColorSpace.YCbCr,
|
|
quant_table: 3,
|
|
trellis_multipass: false,
|
|
trellis_opt_zero: false,
|
|
trellis_opt_table: false,
|
|
trellis_loops: 1,
|
|
};
|