Add support for input array to join or animate #1580

This commit is contained in:
Lovell Fuller
2025-02-07 13:53:27 +00:00
parent 67ff930535
commit 5ab9168813
12 changed files with 377 additions and 20 deletions

48
lib/index.d.ts vendored
View File

@@ -40,19 +40,7 @@ import { Duplex } from 'stream';
*/
declare function sharp(options?: sharp.SharpOptions): sharp.Sharp;
declare function sharp(
input?:
| Buffer
| ArrayBuffer
| Uint8Array
| Uint8ClampedArray
| Int8Array
| Uint16Array
| Int16Array
| Uint32Array
| Int32Array
| Float32Array
| Float64Array
| string,
input?: sharp.SharpInput | Array<sharp.SharpInput>,
options?: sharp.SharpOptions,
): sharp.Sharp;
@@ -945,6 +933,19 @@ declare namespace sharp {
//#endregion
}
type SharpInput = Buffer
| ArrayBuffer
| Uint8Array
| Uint8ClampedArray
| Int8Array
| Uint16Array
| Int16Array
| Uint32Array
| Int32Array
| Float32Array
| Float64Array
| string;
interface SharpOptions {
/**
* Auto-orient based on the EXIF `Orientation` tag, if present.
@@ -998,6 +999,8 @@ declare namespace sharp {
create?: Create | undefined;
/** Describes a new text image to be created. */
text?: CreateText | undefined;
/** Describes how array of input images should be joined. */
join?: Join | undefined;
}
interface CacheOptions {
@@ -1078,6 +1081,21 @@ declare namespace sharp {
wrap?: TextWrap;
}
interface Join {
/** Number of images per row. */
across?: number | undefined;
/** Treat input as frames of an animated image. */
animated?: boolean | undefined;
/** Space between images, in pixels. */
shim?: number | undefined;
/** Background colour. */
background?: Colour | Color | undefined;
/** Horizontal alignment. */
halign?: HorizontalAlignment | undefined;
/** Vertical alignment. */
valign?: VerticalAlignment | undefined;
}
interface ExifDir {
[k: string]: string;
}
@@ -1716,6 +1734,10 @@ declare namespace sharp {
type TextWrap = 'word' | 'char' | 'word-char' | 'none';
type HorizontalAlignment = 'left' | 'centre' | 'center' | 'right';
type VerticalAlignment = 'top' | 'centre' | 'center' | 'bottom';
type TileContainer = 'fs' | 'zip';
type TileLayout = 'dz' | 'iiif' | 'iiif3' | 'zoomify' | 'google';