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
27 lines
696 B
TypeScript
27 lines
696 B
TypeScript
type BitmapResizeMethods = 'browser-pixelated' | 'browser-low' | 'browser-medium' | 'browser-high';
|
|
|
|
export interface ResizeOptions {
|
|
width: number;
|
|
height: number;
|
|
method: 'vector' | BitmapResizeMethods;
|
|
fitMethod: 'stretch' | 'cover';
|
|
}
|
|
|
|
export interface BitmapResizeOptions extends ResizeOptions {
|
|
method: BitmapResizeMethods;
|
|
}
|
|
|
|
export interface VectorResizeOptions extends ResizeOptions {
|
|
method: 'vector';
|
|
}
|
|
|
|
export const defaultOptions: ResizeOptions = {
|
|
// Width and height will always default to the image size.
|
|
// This is set elsewhere.
|
|
width: 1,
|
|
height: 1,
|
|
// This will be set to 'vector' if the input is SVG.
|
|
method: 'browser-high',
|
|
fitMethod: 'stretch',
|
|
};
|