diff --git a/types/sharp/index.d.ts b/types/sharp/index.d.ts index 3f6cc07c45..24232ff87b 100644 --- a/types/sharp/index.d.ts +++ b/types/sharp/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for sharp 0.22 +// Type definitions for sharp 0.23 // Project: https://github.com/lovell/sharp // Definitions by: François Nguyen // Wooseop Kim // Bradley Odell // Jamie Woodbury +// Floris de Bijl // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -209,7 +210,7 @@ declare namespace sharp { * @throws {Error} Invalid parameters * @returns A sharp instance that can be used to chain operations */ - composite(images: Array<{ input: string | Buffer } & OverlayOptions>): Sharp; + composite(images: OverlayOptions[]): Sharp; //#endregion @@ -779,6 +780,10 @@ declare namespace sharp { lossless?: boolean; /** Use near_lossless compression mode (optional, default false) */ nearLossless?: boolean; + /** Use high quality chroma subsampling (optional, default false) */ + smartSubsample?: boolean; + /** Level of CPU effort to reduce file size, integer 0-6 (optional, default 4) */ + reductionEffort?: number; } interface TiffOptions extends OutputOptions { @@ -897,6 +902,8 @@ declare namespace sharp { } interface OverlayOptions { + /** Buffer containing image data, String containing the path to an image file, or Create object */ + input?: string | Buffer | {create: Create}; /** how to blend this image with the image below. (optional, default `'over'`) */ blend?: Blend; /** gravity at which to place the overlay. (optional, default 'centre') */ @@ -907,14 +914,12 @@ declare namespace sharp { left?: number; /** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */ tile?: boolean; - /** set to true to apply only the alpha channel of the overlay image to the input image, giving the appearance of one image being cut out of another. (optional, default false) */ - cutout?: boolean; /** number representing the DPI for vector overlay image. (optional, default 72) */ density?: number; /** describes overlay when using raw pixel data. */ raw?: Raw; - /** describes a blank overlay to be created. */ - create?: Create; + /** Set to true to avoid premultipling the image below. Equivalent to the --premultiplied vips option. */ + premultiplied?: boolean; } interface TileOptions { @@ -926,10 +931,12 @@ declare namespace sharp { angle?: number; /** How deep to make the pyramid, possible values are "onepixel", "onetile" or "one" (default based on layout) */ depth?: string; + /** Threshold to skip tile generation, a value 0 - 255 for 8-bit images or 0 - 65535 for 16-bit images */ + skipBlanks?: number; /** Tile container, with value fs (filesystem) or zip (compressed file). (optional, default 'fs') */ container?: string; /** Filesystem layout, possible values are dz, zoomify or google. (optional, default 'dz') */ - layout?: string; + layout?: TileLayout; } interface OutputInfo { @@ -982,6 +989,8 @@ declare namespace sharp { srgb: string; } + type TileLayout = 'dz' | 'zoomify' | 'google'; + type Blend = 'clear' | 'source' | 'over' | 'in' | 'out' | 'atop' | 'dest' | 'dest-over' | 'dest-in' | 'dest-out' | 'dest-atop' | 'xor' | 'add' | 'saturate' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'colour-dodge' | 'colour-dodge' | 'colour-burn' | 'colour-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion';