mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-14 09:39:15 +00:00
Better resize methods (#498)
* Port resize to wasm * Expose resize algorithms * Lanczos3 working! * lol copy paste * Adding support for other resizers * Don’t track generated README * Cache wasm instance
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
type BitmapResizeMethods = 'browser-pixelated' | 'browser-low' | 'browser-medium' | 'browser-high';
|
||||
type BrowserResizeMethods = 'browser-pixelated' | 'browser-low' | 'browser-medium' | 'browser-high';
|
||||
type WorkerResizeMethods = 'point' | 'triangle' | 'catrom' | 'mitchell' | 'lanczos3';
|
||||
|
||||
export interface ResizeOptions {
|
||||
width: number;
|
||||
height: number;
|
||||
method: 'vector' | BitmapResizeMethods;
|
||||
method: 'vector' | BrowserResizeMethods | WorkerResizeMethods;
|
||||
fitMethod: 'stretch' | 'contain';
|
||||
}
|
||||
|
||||
export interface BitmapResizeOptions extends ResizeOptions {
|
||||
method: BitmapResizeMethods;
|
||||
export interface BrowserResizeOptions extends ResizeOptions {
|
||||
method: BrowserResizeMethods;
|
||||
}
|
||||
|
||||
export interface WorkerResizeOptions extends ResizeOptions {
|
||||
method: WorkerResizeMethods;
|
||||
}
|
||||
|
||||
export interface VectorResizeOptions extends ResizeOptions {
|
||||
@@ -21,6 +26,6 @@ export const defaultOptions: ResizeOptions = {
|
||||
width: 1,
|
||||
height: 1,
|
||||
// This will be set to 'vector' if the input is SVG.
|
||||
method: 'browser-high',
|
||||
method: 'lanczos3',
|
||||
fitMethod: 'stretch',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user