mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
TypeScript: add missing WebpPresetEnum (#3748)
This commit is contained in:
parent
bc8f983329
commit
ffefbd2ecc
11
lib/index.d.ts
vendored
11
lib/index.d.ts
vendored
@ -1127,6 +1127,8 @@ declare namespace sharp {
|
||||
minSize?: number;
|
||||
/** Allow mixture of lossy and lossless animation frames (slow) (optional, default false) */
|
||||
mixed?: boolean;
|
||||
/** Preset options: one of default, photo, picture, drawing, icon, text (optional, default 'default') */
|
||||
preset?: keyof PresetEnum | undefined;
|
||||
}
|
||||
|
||||
interface AvifOptions extends OutputOptions {
|
||||
@ -1476,6 +1478,15 @@ declare namespace sharp {
|
||||
lanczos3: 'lanczos3';
|
||||
}
|
||||
|
||||
interface PresetEnum {
|
||||
default: 'default';
|
||||
picture: 'picture';
|
||||
photo: 'photo';
|
||||
drawing: 'drawing';
|
||||
icon: 'icon';
|
||||
text: 'text';
|
||||
}
|
||||
|
||||
interface BoolEnum {
|
||||
and: 'and';
|
||||
or: 'or';
|
||||
|
@ -651,3 +651,13 @@ sharp(input).composite([
|
||||
unlimited: true,
|
||||
}
|
||||
]);
|
||||
|
||||
// Support for webp preset in types
|
||||
// https://github.com/lovell/sharp/issues/3747
|
||||
sharp('input.tiff').webp({ preset: 'photo' }).toFile('out.webp');
|
||||
sharp('input.tiff').webp({ preset: 'picture' }).toFile('out.webp');
|
||||
sharp('input.tiff').webp({ preset: 'icon' }).toFile('out.webp');
|
||||
sharp('input.tiff').webp({ preset: 'drawing' }).toFile('out.webp');
|
||||
sharp('input.tiff').webp({ preset: 'text' }).toFile('out.webp');
|
||||
sharp('input.tiff').webp({ preset: 'default' }).toFile('out.webp');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user