mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
Update sharp types for 0.22.0
This commit is contained in:
Vendored
+23
-4
@@ -1,4 +1,4 @@
|
||||
// Type definitions for sharp 0.21
|
||||
// Type definitions for sharp 0.22
|
||||
// Project: https://github.com/lovell/sharp
|
||||
// Definitions by: François Nguyen <https://github.com/lith-light-g>
|
||||
// Wooseop Kim <https://github.com/wooseopkim>
|
||||
@@ -138,7 +138,7 @@ declare namespace sharp {
|
||||
* @throws {Error} Invalid parameters
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
*/
|
||||
joinChannel(images: string | Buffer | ArrayLike<string|Buffer>, options?: SharpOptions): Sharp;
|
||||
joinChannel(images: string | Buffer | ArrayLike<string | Buffer>, options?: SharpOptions): Sharp;
|
||||
|
||||
/**
|
||||
* Perform a bitwise boolean operation on all input image channels (bands) to produce a single channel output image.
|
||||
@@ -211,9 +211,21 @@ declare namespace sharp {
|
||||
* @param options overlay options
|
||||
* @throws {Error} Invalid parameters
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
* @deprecated
|
||||
*/
|
||||
overlayWith(image?: string | Buffer, options?: OverlayOptions): Sharp;
|
||||
|
||||
/**
|
||||
* Composite image(s) over the processed (resized, extracted etc.) image.
|
||||
*
|
||||
* The images to composite must be the same size or smaller than the processed image.
|
||||
* If both `top` and `left` options are provided, they take precedence over `gravity`.
|
||||
* @param images - Ordered list of images to composite
|
||||
* @throws {Error} Invalid parameters
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
*/
|
||||
composite(images: Array<{ input: string | Buffer } & OverlayOptions>): Sharp;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Input functions
|
||||
@@ -570,7 +582,7 @@ declare namespace sharp {
|
||||
* @throws {Error} Invalid parameters
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
*/
|
||||
resize(width?: number|null, height?: number|null, options?: ResizeOptions): Sharp;
|
||||
resize(width?: number | null, height?: number | null, options?: ResizeOptions): Sharp;
|
||||
|
||||
/**
|
||||
* Extends/pads the edges of the image with the provided background colour.
|
||||
@@ -615,7 +627,9 @@ declare namespace sharp {
|
||||
failOnError?: boolean;
|
||||
/** Number representing the DPI for vector images. (optional, default 72) */
|
||||
density?: number;
|
||||
/** Page number to extract for multi-page input (GIF, TIFF). (optional, default 0) */
|
||||
/** Number of pages to extract for multi-page input (GIF, TIFF, PDF), use -1 for all pages */
|
||||
pages?: number;
|
||||
/** Page number to start extracting from for multi-page input (GIF, TIFF, PDF), zero based. (optional, default 0) */
|
||||
page?: number;
|
||||
/** Describes raw pixel input image data. See raw() for pixel ordering. */
|
||||
raw?: Raw;
|
||||
@@ -883,6 +897,8 @@ declare namespace sharp {
|
||||
}
|
||||
|
||||
interface OverlayOptions {
|
||||
/** how to blend this image with the image below. (optional, default `'over'`) */
|
||||
blend?: Blend;
|
||||
/** gravity at which to place the overlay. (optional, default 'centre') */
|
||||
gravity?: Gravity;
|
||||
/** the pixel offset from the top edge. */
|
||||
@@ -966,6 +982,9 @@ declare namespace sharp {
|
||||
srgb: string;
|
||||
}
|
||||
|
||||
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';
|
||||
|
||||
type Gravity = number | string;
|
||||
|
||||
interface GravityEnum {
|
||||
|
||||
@@ -26,7 +26,7 @@ sharp('input.png')
|
||||
.rotate(180)
|
||||
.resize(300)
|
||||
.flatten({ background: "#ff6600" })
|
||||
.overlayWith('overlay.png', { gravity: sharp.gravity.southeast })
|
||||
.composite([{ input: 'overlay.png', gravity: sharp.gravity.southeast }])
|
||||
.sharpen()
|
||||
.withMetadata()
|
||||
.webp({
|
||||
|
||||
Reference in New Issue
Block a user