mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[sharp] update typings to 0.25 (#44062)
This commit is contained in:
parent
76f7731c06
commit
c20f656591
27
types/sharp/index.d.ts
vendored
27
types/sharp/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for sharp 0.24
|
||||
// Type definitions for sharp 0.25
|
||||
// Project: https://github.com/lovell/sharp
|
||||
// Definitions by: François Nguyen <https://github.com/lith-light-g>
|
||||
// Wooseop Kim <https://github.com/wooseopkim>
|
||||
@ -248,27 +248,6 @@ declare namespace sharp {
|
||||
*/
|
||||
stats(): Promise<Stats>;
|
||||
|
||||
/**
|
||||
* Do not process input images where the number of pixels (width _ height) exceeds this limit.
|
||||
* Assumes image dimensions contained in the input metadata can be trusted.
|
||||
* The default limit is 268402689 (0x3FFF _ 0x3FFF) pixels.
|
||||
* @param limit An integral Number of pixels, zero or false to remove limit, true to use default limit.
|
||||
* @throws {Error} Invalid limit
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
* @deprecated since version 0.24.0 - moved to @see sharp.SharpOptions
|
||||
*/
|
||||
limitInputPixels(limit: number | boolean): Sharp;
|
||||
|
||||
/**
|
||||
* An advanced setting that switches the libvips access method to VIPS_ACCESS_SEQUENTIAL.
|
||||
* This will reduce memory usage and can improve performance on some systems.
|
||||
* The default behaviour before function call is false, meaning the libvips access method is not sequential.
|
||||
* @param sequentialRead true to enable and false to disable (defaults to true)
|
||||
* @returns A sharp instance that can be used to chain operations
|
||||
* @deprecated since version 0.24.0 - moved to @see sharp.SharpOptions
|
||||
*/
|
||||
sequentialRead(sequentialRead?: boolean): Sharp;
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Operation functions
|
||||
@ -968,7 +947,7 @@ declare namespace sharp {
|
||||
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') */
|
||||
/** Filesystem layout, possible values are dz, iiif, zoomify or google. (optional, default 'dz') */
|
||||
layout?: TileLayout;
|
||||
}
|
||||
|
||||
@ -1022,7 +1001,7 @@ declare namespace sharp {
|
||||
srgb: string;
|
||||
}
|
||||
|
||||
type TileLayout = 'dz' | 'zoomify' | 'google';
|
||||
type TileLayout = 'dz' | 'iiif' | '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';
|
||||
|
||||
@ -253,3 +253,22 @@ sharp('input.gif')
|
||||
.modulate({ hue: 180 })
|
||||
.modulate({ brightness: 0.5, saturation: 0.5, hue: 90 })
|
||||
;
|
||||
|
||||
// From https://sharp.pixelplumbing.com/api-output#examples-9
|
||||
// Extract raw RGB pixel data from JPEG input
|
||||
sharp('input.jpg')
|
||||
.raw()
|
||||
.toBuffer({ resolveWithObject: true })
|
||||
.then(({data, info}) => {
|
||||
console.log(data);
|
||||
console.log(info);
|
||||
});
|
||||
|
||||
// From https://sharp.pixelplumbing.com/api-output#examples-9
|
||||
// Extract alpha channel as raw pixel data from PNG input
|
||||
sharp('input.png')
|
||||
.ensureAlpha()
|
||||
.extractChannel(3)
|
||||
.toColourspace('b-w')
|
||||
.raw()
|
||||
.toBuffer();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user