Skip to content

Commit

Permalink
Types: include base input options for composite #3669
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed May 16, 2023
1 parent de0fc07 commit 3340120
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
21 changes: 2 additions & 19 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1350,9 +1350,9 @@ declare namespace sharp {
grayscale?: boolean | undefined;
}

interface OverlayOptions {
interface OverlayOptions extends SharpOptions {
/** Buffer containing image data, String containing the path to an image file, or Create object */
input?: string | Buffer | { create: Create } | { text: CreateText } | undefined;
input?: string | Buffer | { create: Create } | { text: CreateText } | { raw: CreateRaw } | undefined;
/** how to blend this image with the image below. (optional, default `'over'`) */
blend?: Blend | undefined;
/** gravity at which to place the overlay. (optional, default 'centre') */
Expand All @@ -1363,25 +1363,8 @@ declare namespace sharp {
left?: number | undefined;
/** set to true to repeat the overlay image across the entire image with the given gravity. (optional, default false) */
tile?: boolean | undefined;
/** number representing the DPI for vector overlay image. (optional, default 72) */
density?: number | undefined;
/** describes overlay when using raw pixel data. */
raw?: Raw | undefined;
/** Set to true to avoid premultipling the image below. Equivalent to the --premultiplied vips option. */
premultiplied?: boolean | undefined;
/** Set to true to read all frames/pages of an animated image. (optional, default false). */
animated?: boolean | undefined;
/**
* When to abort processing of invalid pixel data, one of (in order of sensitivity):
* 'none' (least), 'truncated', 'error' or 'warning' (most), highers level imply lower levels, invalid metadata will always abort. (optional, default 'warning')
*/
failOn?: FailOnOptions | undefined;
/**
* Do not process input images where the number of pixels (width x height) exceeds this limit.
* Assumes image dimensions contained in the input metadata can be trusted.
* An integral Number of pixels, zero or false to remove limit, true to use default limit of 268402689 (0x3FFF x 0x3FFF). (optional, default 268402689)
*/
limitInputPixels?: number | boolean | undefined;
}

interface TileOptions {
Expand Down
14 changes: 14 additions & 0 deletions test/types/sharp.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -637,3 +637,17 @@ sharp('input.png').composite([
sharp('input.png').tile({
basename: 'output.dz.tiles',
});

// https://github.com/lovell/sharp/issues/3669
sharp(input).composite([
{
raw: {
width: 1,
height: 1,
channels: 1,
premultiplied: false,
},
sequentialRead: false,
unlimited: true,
}
]);

0 comments on commit 3340120

Please sign in to comment.