@revizly/sharp 0.34.1-revizly9 → 0.34.4-revizly10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/install/check.js +2 -4
- package/lib/channel.js +2 -2
- package/lib/colour.js +1 -3
- package/lib/composite.js +0 -2
- package/lib/constructor.js +20 -9
- package/lib/index.d.ts +116 -21
- package/lib/index.js +0 -2
- package/lib/input.js +117 -31
- package/lib/is.js +0 -2
- package/lib/libvips.js +22 -22
- package/lib/operation.js +0 -2
- package/lib/output.js +67 -4
- package/lib/resize.js +10 -7
- package/lib/sharp.js +3 -6
- package/lib/utility.js +6 -14
- package/package.json +28 -48
- package/src/binding.gyp +8 -4
- package/src/common.cc +84 -73
- package/src/common.h +23 -23
- package/src/metadata.cc +9 -3
- package/src/metadata.h +1 -0
- package/src/operations.cc +2 -2
- package/src/operations.h +1 -0
- package/src/pipeline.cc +64 -73
- package/src/pipeline.h +6 -2
- package/src/sharp.cc +6 -6
- package/src/stats.cc +5 -4
- package/src/stats.h +2 -1
- package/src/utilities.cc +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# sharp
|
|
2
2
|
|
|
3
|
-
<img src="https://
|
|
3
|
+
<img src="https://sharp.pixelplumbing.com/sharp-logo.svg" width="160" height="160" alt="sharp logo" align="right">
|
|
4
4
|
|
|
5
5
|
The typical use case for this high speed Node-API module
|
|
6
6
|
is to convert large images in common formats to
|
package/install/check.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright 2013 Lovell Fuller and others.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
4
|
try {
|
|
7
5
|
const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
|
|
8
6
|
|
|
@@ -12,14 +10,14 @@ try {
|
|
|
12
10
|
try {
|
|
13
11
|
const addonApi = require('node-addon-api');
|
|
14
12
|
log(`Found node-addon-api ${addonApi.version || ''}`);
|
|
15
|
-
} catch (
|
|
13
|
+
} catch (_err) {
|
|
16
14
|
log('Please add node-addon-api to your dependencies');
|
|
17
15
|
return;
|
|
18
16
|
}
|
|
19
17
|
try {
|
|
20
18
|
const gyp = require('node-gyp');
|
|
21
19
|
log(`Found node-gyp ${gyp().version}`);
|
|
22
|
-
} catch (
|
|
20
|
+
} catch (_err) {
|
|
23
21
|
log('Please add node-gyp to your dependencies');
|
|
24
22
|
return;
|
|
25
23
|
}
|
package/lib/channel.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright 2013 Lovell Fuller and others.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
4
|
const is = require('./is');
|
|
7
5
|
|
|
8
6
|
/**
|
|
@@ -74,6 +72,8 @@ function ensureAlpha (alpha) {
|
|
|
74
72
|
/**
|
|
75
73
|
* Extract a single channel from a multi-channel image.
|
|
76
74
|
*
|
|
75
|
+
* The output colourspace will be either `b-w` (8-bit) or `grey16` (16-bit).
|
|
76
|
+
*
|
|
77
77
|
* @example
|
|
78
78
|
* // green.jpg is a greyscale image containing the green channel of the input
|
|
79
79
|
* await sharp(input)
|
package/lib/colour.js
CHANGED
package/lib/composite.js
CHANGED
package/lib/constructor.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// Copyright 2013 Lovell Fuller and others.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
4
|
const util = require('node:util');
|
|
7
5
|
const stream = require('node:stream');
|
|
8
6
|
const is = require('./is');
|
|
@@ -153,9 +151,6 @@ const debuglog = util.debuglog('sharp');
|
|
|
153
151
|
* @param {number} [options.ignoreIcc=false] - should the embedded ICC profile, if any, be ignored.
|
|
154
152
|
* @param {number} [options.pages=1] - Number of pages to extract for multi-page input (GIF, WebP, TIFF), use -1 for all pages.
|
|
155
153
|
* @param {number} [options.page=0] - Page number to start extracting from for multi-page input (GIF, WebP, TIFF), zero based.
|
|
156
|
-
* @param {number} [options.subifd=-1] - subIFD (Sub Image File Directory) to extract for OME-TIFF, defaults to main image.
|
|
157
|
-
* @param {number} [options.level=0] - level to extract from a multi-level input (OpenSlide), zero based.
|
|
158
|
-
* @param {string|Object} [options.pdfBackground] - Background colour to use when PDF is partially transparent. Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick.
|
|
159
154
|
* @param {boolean} [options.animated=false] - Set to `true` to read all frames/pages of an animated image (GIF, WebP, TIFF), equivalent of setting `pages` to `-1`.
|
|
160
155
|
* @param {Object} [options.raw] - describes raw pixel input image data. See `raw()` for pixel ordering.
|
|
161
156
|
* @param {number} [options.raw.width] - integral number of pixels wide.
|
|
@@ -163,15 +158,17 @@ const debuglog = util.debuglog('sharp');
|
|
|
163
158
|
* @param {number} [options.raw.channels] - integral number of channels, between 1 and 4.
|
|
164
159
|
* @param {boolean} [options.raw.premultiplied] - specifies that the raw input has already been premultiplied, set to `true`
|
|
165
160
|
* to avoid sharp premultiplying the image. (optional, default `false`)
|
|
161
|
+
* @param {number} [options.raw.pageHeight] - The pixel height of each page/frame for animated images, must be an integral factor of `raw.height`.
|
|
166
162
|
* @param {Object} [options.create] - describes a new image to be created.
|
|
167
163
|
* @param {number} [options.create.width] - integral number of pixels wide.
|
|
168
164
|
* @param {number} [options.create.height] - integral number of pixels high.
|
|
169
165
|
* @param {number} [options.create.channels] - integral number of channels, either 3 (RGB) or 4 (RGBA).
|
|
170
166
|
* @param {string|Object} [options.create.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
|
167
|
+
* @param {number} [options.create.pageHeight] - The pixel height of each page/frame for animated images, must be an integral factor of `create.height`.
|
|
171
168
|
* @param {Object} [options.create.noise] - describes a noise to be created.
|
|
172
169
|
* @param {string} [options.create.noise.type] - type of generated noise, currently only `gaussian` is supported.
|
|
173
|
-
* @param {number} [options.create.noise.mean] -
|
|
174
|
-
* @param {number} [options.create.noise.sigma] -
|
|
170
|
+
* @param {number} [options.create.noise.mean=128] - Mean value of pixels in the generated noise.
|
|
171
|
+
* @param {number} [options.create.noise.sigma=30] - Standard deviation of pixel values in the generated noise.
|
|
175
172
|
* @param {Object} [options.text] - describes a new text image to be created.
|
|
176
173
|
* @param {string} [options.text.text] - text to render as a UTF-8 string. It can contain Pango markup, for example `<i>Le</i>Monde`.
|
|
177
174
|
* @param {string} [options.text.font] - font name to render with.
|
|
@@ -191,11 +188,22 @@ const debuglog = util.debuglog('sharp');
|
|
|
191
188
|
* @param {string|Object} [options.join.background] - parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
|
192
189
|
* @param {string} [options.join.halign='left'] - horizontal alignment style for images joined horizontally (`'left'`, `'centre'`, `'center'`, `'right'`).
|
|
193
190
|
* @param {string} [options.join.valign='top'] - vertical alignment style for images joined vertically (`'top'`, `'centre'`, `'center'`, `'bottom'`).
|
|
194
|
-
*
|
|
191
|
+
* @param {Object} [options.tiff] - Describes TIFF specific options.
|
|
192
|
+
* @param {number} [options.tiff.subifd=-1] - Sub Image File Directory to extract for OME-TIFF, defaults to main image.
|
|
193
|
+
* @param {Object} [options.svg] - Describes SVG specific options.
|
|
194
|
+
* @param {string} [options.svg.stylesheet] - Custom CSS for SVG input, applied with a User Origin during the CSS cascade.
|
|
195
|
+
* @param {boolean} [options.svg.highBitdepth=false] - Set to `true` to render SVG input at 32-bits per channel (128-bit) instead of 8-bits per channel (32-bit) RGBA.
|
|
196
|
+
* @param {Object} [options.pdf] - Describes PDF specific options. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick.
|
|
197
|
+
* @param {string|Object} [options.pdf.background] - Background colour to use when PDF is partially transparent. Parsed by the [color](https://www.npmjs.org/package/color) module to extract values for red, green, blue and alpha.
|
|
198
|
+
* @param {Object} [options.openSlide] - Describes OpenSlide specific options. Requires the use of a globally-installed libvips compiled with support for OpenSlide.
|
|
199
|
+
* @param {number} [options.openSlide.level=0] - Level to extract from a multi-level input, zero based.
|
|
200
|
+
* @param {Object} [options.jp2] - Describes JPEG 2000 specific options. Requires the use of a globally-installed libvips compiled with support for OpenJPEG.
|
|
201
|
+
* @param {boolean} [options.jp2.oneshot=false] - Set to `true` to decode tiled JPEG 2000 images in a single operation, improving compatibility.
|
|
195
202
|
* @returns {Sharp}
|
|
196
203
|
* @throws {Error} Invalid parameters
|
|
197
204
|
*/
|
|
198
205
|
const Sharp = function (input, options) {
|
|
206
|
+
// biome-ignore lint/complexity/noArguments: constructor factory
|
|
199
207
|
if (arguments.length === 1 && !is.defined(input)) {
|
|
200
208
|
throw new Error('Invalid input');
|
|
201
209
|
}
|
|
@@ -221,7 +229,8 @@ const Sharp = function (input, options) {
|
|
|
221
229
|
angle: 0,
|
|
222
230
|
rotationAngle: 0,
|
|
223
231
|
rotationBackground: [0, 0, 0, 255],
|
|
224
|
-
|
|
232
|
+
rotateBefore: false,
|
|
233
|
+
orientBefore: false,
|
|
225
234
|
flip: false,
|
|
226
235
|
flop: false,
|
|
227
236
|
extendTop: 0,
|
|
@@ -297,6 +306,7 @@ const Sharp = function (input, options) {
|
|
|
297
306
|
withIccProfile: '',
|
|
298
307
|
withExif: {},
|
|
299
308
|
withExifMerge: true,
|
|
309
|
+
withXmp: '',
|
|
300
310
|
resolveWithObject: false,
|
|
301
311
|
loop: -1,
|
|
302
312
|
delay: [],
|
|
@@ -337,6 +347,7 @@ const Sharp = function (input, options) {
|
|
|
337
347
|
gifDither: 1,
|
|
338
348
|
gifInterFrameMaxError: 0,
|
|
339
349
|
gifInterPaletteMaxError: 3,
|
|
350
|
+
gifKeepDuplicateFrames: false,
|
|
340
351
|
gifReuse: true,
|
|
341
352
|
gifProgressive: false,
|
|
342
353
|
tiffQuality: 80,
|
package/lib/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
/// <reference types="node" />
|
|
29
29
|
|
|
30
|
-
import { Duplex } from 'stream';
|
|
30
|
+
import type { Duplex } from 'node:stream';
|
|
31
31
|
|
|
32
32
|
//#region Constructor functions
|
|
33
33
|
|
|
@@ -419,7 +419,7 @@ declare namespace sharp {
|
|
|
419
419
|
* @returns {Sharp}
|
|
420
420
|
*/
|
|
421
421
|
autoOrient(): Sharp
|
|
422
|
-
|
|
422
|
+
|
|
423
423
|
/**
|
|
424
424
|
* Flip the image about the vertical Y axis. This always occurs after rotation, if any.
|
|
425
425
|
* The use of flip implies the removal of the EXIF Orientation tag, if any.
|
|
@@ -730,6 +730,20 @@ declare namespace sharp {
|
|
|
730
730
|
*/
|
|
731
731
|
withIccProfile(icc: string, options?: WithIccProfileOptions): Sharp;
|
|
732
732
|
|
|
733
|
+
/**
|
|
734
|
+
* Keep all XMP metadata from the input image in the output image.
|
|
735
|
+
* @returns A sharp instance that can be used to chain operations
|
|
736
|
+
*/
|
|
737
|
+
keepXmp(): Sharp;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Set XMP metadata in the output image.
|
|
741
|
+
* @param {string} xmp - String containing XMP metadata to be embedded in the output image.
|
|
742
|
+
* @returns A sharp instance that can be used to chain operations
|
|
743
|
+
* @throws {Error} Invalid parameters
|
|
744
|
+
*/
|
|
745
|
+
withXmp(xmp: string): Sharp;
|
|
746
|
+
|
|
733
747
|
/**
|
|
734
748
|
* Include all metadata (EXIF, XMP, IPTC) from the input image in the output image.
|
|
735
749
|
* The default behaviour, when withMetadata is not used, is to strip all metadata and convert to the device-independent sRGB colour space.
|
|
@@ -1003,12 +1017,22 @@ declare namespace sharp {
|
|
|
1003
1017
|
pages?: number | undefined;
|
|
1004
1018
|
/** Page number to start extracting from for multi-page input (GIF, TIFF, PDF), zero based. (optional, default 0) */
|
|
1005
1019
|
page?: number | undefined;
|
|
1006
|
-
/**
|
|
1020
|
+
/** TIFF specific input options */
|
|
1021
|
+
tiff?: TiffInputOptions | undefined;
|
|
1022
|
+
/** SVG specific input options */
|
|
1023
|
+
svg?: SvgInputOptions | undefined;
|
|
1024
|
+
/** PDF specific input options */
|
|
1025
|
+
pdf?: PdfInputOptions | undefined;
|
|
1026
|
+
/** OpenSlide specific input options */
|
|
1027
|
+
openSlide?: OpenSlideInputOptions | undefined;
|
|
1028
|
+
/** JPEG 2000 specific input options */
|
|
1029
|
+
jp2?: Jp2InputOptions | undefined;
|
|
1030
|
+
/** Deprecated: use tiff.subifd instead */
|
|
1007
1031
|
subifd?: number | undefined;
|
|
1008
|
-
/**
|
|
1009
|
-
level?: number | undefined;
|
|
1010
|
-
/** Background colour to use when PDF is partially transparent. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. */
|
|
1032
|
+
/** Deprecated: use pdf.background instead */
|
|
1011
1033
|
pdfBackground?: Colour | Color | undefined;
|
|
1034
|
+
/** Deprecated: use openSlide.level instead */
|
|
1035
|
+
level?: number | undefined;
|
|
1012
1036
|
/** Set to `true` to read all frames/pages of an animated image (equivalent of setting `pages` to `-1`). (optional, default false) */
|
|
1013
1037
|
animated?: boolean | undefined;
|
|
1014
1038
|
/** Describes raw pixel input image data. See raw() for pixel ordering. */
|
|
@@ -1051,6 +1075,8 @@ declare namespace sharp {
|
|
|
1051
1075
|
interface CreateRaw extends Raw {
|
|
1052
1076
|
/** Specifies that the raw input has already been premultiplied, set to true to avoid sharp premultiplying the image. (optional, default false) */
|
|
1053
1077
|
premultiplied?: boolean | undefined;
|
|
1078
|
+
/** The height of each page/frame for animated images, must be an integral factor of the overall image height. */
|
|
1079
|
+
pageHeight?: number | undefined;
|
|
1054
1080
|
}
|
|
1055
1081
|
|
|
1056
1082
|
type CreateChannels = 3 | 4;
|
|
@@ -1066,6 +1092,9 @@ declare namespace sharp {
|
|
|
1066
1092
|
background: Colour | Color;
|
|
1067
1093
|
/** Describes a noise to be created. */
|
|
1068
1094
|
noise?: Noise | undefined;
|
|
1095
|
+
/** The height of each page/frame for animated images, must be an integral factor of the overall image height. */
|
|
1096
|
+
pageHeight?: number | undefined;
|
|
1097
|
+
|
|
1069
1098
|
}
|
|
1070
1099
|
|
|
1071
1100
|
interface CreateText {
|
|
@@ -1114,6 +1143,33 @@ declare namespace sharp {
|
|
|
1114
1143
|
valign?: VerticalAlignment | undefined;
|
|
1115
1144
|
}
|
|
1116
1145
|
|
|
1146
|
+
interface TiffInputOptions {
|
|
1147
|
+
/** Sub Image File Directory to extract, defaults to main image. Use -1 for all subifds. */
|
|
1148
|
+
subifd?: number | undefined;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
interface SvgInputOptions {
|
|
1152
|
+
/** Custom CSS for SVG input, applied with a User Origin during the CSS cascade. */
|
|
1153
|
+
stylesheet?: string | undefined;
|
|
1154
|
+
/** Set to `true` to render SVG input at 32-bits per channel (128-bit) instead of 8-bits per channel (32-bit) RGBA. */
|
|
1155
|
+
highBitdepth?: boolean | undefined;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
interface PdfInputOptions {
|
|
1159
|
+
/** Background colour to use when PDF is partially transparent. Requires the use of a globally-installed libvips compiled with support for PDFium, Poppler, ImageMagick or GraphicsMagick. */
|
|
1160
|
+
background?: Colour | Color | undefined;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
interface OpenSlideInputOptions {
|
|
1164
|
+
/** Level to extract from a multi-level input, zero based. (optional, default 0) */
|
|
1165
|
+
level?: number | undefined;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
interface Jp2InputOptions {
|
|
1169
|
+
/** Set to `true` to load JPEG 2000 images using [oneshot mode](https://github.com/libvips/libvips/issues/4205) */
|
|
1170
|
+
oneshot?: boolean | undefined;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1117
1173
|
interface ExifDir {
|
|
1118
1174
|
[k: string]: string;
|
|
1119
1175
|
}
|
|
@@ -1146,13 +1202,13 @@ declare namespace sharp {
|
|
|
1146
1202
|
/** Number value of the EXIF Orientation header, if present */
|
|
1147
1203
|
orientation?: number | undefined;
|
|
1148
1204
|
/** Name of decoder used to decompress image data e.g. jpeg, png, webp, gif, svg */
|
|
1149
|
-
format
|
|
1205
|
+
format: keyof FormatEnum;
|
|
1150
1206
|
/** Total size of image in bytes, for Stream and Buffer input only */
|
|
1151
1207
|
size?: number | undefined;
|
|
1152
1208
|
/** Number of pixels wide (EXIF orientation is not taken into consideration) */
|
|
1153
|
-
width
|
|
1209
|
+
width: number;
|
|
1154
1210
|
/** Number of pixels high (EXIF orientation is not taken into consideration) */
|
|
1155
|
-
height
|
|
1211
|
+
height: number;
|
|
1156
1212
|
/** Any changed metadata after the image orientation is applied. */
|
|
1157
1213
|
autoOrient: {
|
|
1158
1214
|
/** Number of pixels wide (EXIF orientation is taken into consideration) */
|
|
@@ -1161,19 +1217,19 @@ declare namespace sharp {
|
|
|
1161
1217
|
height: number;
|
|
1162
1218
|
};
|
|
1163
1219
|
/** Name of colour space interpretation */
|
|
1164
|
-
space
|
|
1220
|
+
space: keyof ColourspaceEnum;
|
|
1165
1221
|
/** Number of bands e.g. 3 for sRGB, 4 for CMYK */
|
|
1166
|
-
channels
|
|
1222
|
+
channels: Channels;
|
|
1167
1223
|
/** Name of pixel depth format e.g. uchar, char, ushort, float ... */
|
|
1168
|
-
depth
|
|
1224
|
+
depth: keyof DepthEnum;
|
|
1169
1225
|
/** Number of pixels per inch (DPI), if present */
|
|
1170
1226
|
density?: number | undefined;
|
|
1171
1227
|
/** String containing JPEG chroma subsampling, 4:2:0 or 4:4:4 for RGB, 4:2:0:4 or 4:4:4:4 for CMYK */
|
|
1172
1228
|
chromaSubsampling?: string | undefined;
|
|
1173
1229
|
/** Boolean indicating whether the image is interlaced using a progressive scan */
|
|
1174
|
-
isProgressive
|
|
1230
|
+
isProgressive: boolean;
|
|
1175
1231
|
/** Boolean indicating whether the image is palette-based (GIF, PNG). */
|
|
1176
|
-
isPalette
|
|
1232
|
+
isPalette: boolean;
|
|
1177
1233
|
/** Number of bits per sample for each channel (GIF, PNG). */
|
|
1178
1234
|
bitsPerSample?: number | undefined;
|
|
1179
1235
|
/** Number of pages/frames contained within the image, with support for TIFF, HEIF, PDF, animated GIF and animated WebP */
|
|
@@ -1187,9 +1243,9 @@ declare namespace sharp {
|
|
|
1187
1243
|
/** Number of the primary page in a HEIF image */
|
|
1188
1244
|
pagePrimary?: number | undefined;
|
|
1189
1245
|
/** Boolean indicating the presence of an embedded ICC profile */
|
|
1190
|
-
hasProfile
|
|
1246
|
+
hasProfile: boolean;
|
|
1191
1247
|
/** Boolean indicating the presence of an alpha transparency channel */
|
|
1192
|
-
hasAlpha
|
|
1248
|
+
hasAlpha: boolean;
|
|
1193
1249
|
/** Buffer containing raw EXIF data, if present */
|
|
1194
1250
|
exif?: Buffer | undefined;
|
|
1195
1251
|
/** Buffer containing raw ICC profile data, if present */
|
|
@@ -1198,6 +1254,8 @@ declare namespace sharp {
|
|
|
1198
1254
|
iptc?: Buffer | undefined;
|
|
1199
1255
|
/** Buffer containing raw XMP data, if present */
|
|
1200
1256
|
xmp?: Buffer | undefined;
|
|
1257
|
+
/** String containing XMP data, if valid UTF-8 */
|
|
1258
|
+
xmpAsString?: string | undefined;
|
|
1201
1259
|
/** Buffer containing raw TIFFTAG_PHOTOSHOP data, if present */
|
|
1202
1260
|
tifftagPhotoshop?: Buffer | undefined;
|
|
1203
1261
|
/** The encoder used to compress an HEIF file, `av1` (AVIF) or `hevc` (HEIC) */
|
|
@@ -1336,6 +1394,8 @@ declare namespace sharp {
|
|
|
1336
1394
|
nearLossless?: boolean | undefined;
|
|
1337
1395
|
/** Use high quality chroma subsampling (optional, default false) */
|
|
1338
1396
|
smartSubsample?: boolean | undefined;
|
|
1397
|
+
/** Auto-adjust the deblocking filter, slow but can improve low contrast edges (optional, default false) */
|
|
1398
|
+
smartDeblock?: boolean | undefined;
|
|
1339
1399
|
/** Level of CPU effort to reduce file size, integer 0-6 (optional, default 4) */
|
|
1340
1400
|
effort?: number | undefined;
|
|
1341
1401
|
/** Prevent use of animation key frames to minimise file size (slow) (optional, default false) */
|
|
@@ -1388,9 +1448,11 @@ declare namespace sharp {
|
|
|
1388
1448
|
/** Level of Floyd-Steinberg error diffusion, between 0 (least) and 1 (most) (optional, default 1.0) */
|
|
1389
1449
|
dither?: number | undefined;
|
|
1390
1450
|
/** Maximum inter-frame error for transparency, between 0 (lossless) and 32 (optional, default 0) */
|
|
1391
|
-
interFrameMaxError?: number;
|
|
1451
|
+
interFrameMaxError?: number | undefined;
|
|
1392
1452
|
/** Maximum inter-palette error for palette reuse, between 0 and 256 (optional, default 3) */
|
|
1393
|
-
interPaletteMaxError?: number;
|
|
1453
|
+
interPaletteMaxError?: number | undefined;
|
|
1454
|
+
/** Keep duplicate frames in the output instead of combining them (optional, default false) */
|
|
1455
|
+
keepDuplicateFrames?: boolean | undefined;
|
|
1394
1456
|
}
|
|
1395
1457
|
|
|
1396
1458
|
interface TiffOptions extends OutputOptions {
|
|
@@ -1508,7 +1570,7 @@ declare namespace sharp {
|
|
|
1508
1570
|
|
|
1509
1571
|
interface Noise {
|
|
1510
1572
|
/** type of generated noise, currently only gaussian is supported. */
|
|
1511
|
-
type
|
|
1573
|
+
type: 'gaussian';
|
|
1512
1574
|
/** mean of pixels in generated noise. */
|
|
1513
1575
|
mean?: number | undefined;
|
|
1514
1576
|
/** standard deviation of pixels in generated noise. */
|
|
@@ -1722,9 +1784,12 @@ declare namespace sharp {
|
|
|
1722
1784
|
interface KernelEnum {
|
|
1723
1785
|
nearest: 'nearest';
|
|
1724
1786
|
cubic: 'cubic';
|
|
1787
|
+
linear: 'linear';
|
|
1725
1788
|
mitchell: 'mitchell';
|
|
1726
1789
|
lanczos2: 'lanczos2';
|
|
1727
1790
|
lanczos3: 'lanczos3';
|
|
1791
|
+
mks2013: 'mks2013';
|
|
1792
|
+
mks2021: 'mks2021';
|
|
1728
1793
|
}
|
|
1729
1794
|
|
|
1730
1795
|
interface PresetEnum {
|
|
@@ -1743,11 +1808,38 @@ declare namespace sharp {
|
|
|
1743
1808
|
}
|
|
1744
1809
|
|
|
1745
1810
|
interface ColourspaceEnum {
|
|
1746
|
-
multiband: string;
|
|
1747
1811
|
'b-w': string;
|
|
1748
|
-
|
|
1812
|
+
cmc: string;
|
|
1749
1813
|
cmyk: string;
|
|
1814
|
+
fourier: string;
|
|
1815
|
+
grey16: string;
|
|
1816
|
+
histogram: string;
|
|
1817
|
+
hsv: string;
|
|
1818
|
+
lab: string;
|
|
1819
|
+
labq: string;
|
|
1820
|
+
labs: string;
|
|
1821
|
+
lch: string;
|
|
1822
|
+
matrix: string;
|
|
1823
|
+
multiband: string;
|
|
1824
|
+
rgb: string;
|
|
1825
|
+
rgb16: string;
|
|
1826
|
+
scrgb: string;
|
|
1750
1827
|
srgb: string;
|
|
1828
|
+
xyz: string;
|
|
1829
|
+
yxy: string;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
interface DepthEnum {
|
|
1833
|
+
char: string;
|
|
1834
|
+
complex: string;
|
|
1835
|
+
double: string;
|
|
1836
|
+
dpcomplex: string;
|
|
1837
|
+
float: string;
|
|
1838
|
+
int: string;
|
|
1839
|
+
short: string;
|
|
1840
|
+
uchar: string;
|
|
1841
|
+
uint: string;
|
|
1842
|
+
ushort: string;
|
|
1751
1843
|
}
|
|
1752
1844
|
|
|
1753
1845
|
type FailOnOptions = 'none' | 'truncated' | 'error' | 'warning';
|
|
@@ -1815,7 +1907,9 @@ declare namespace sharp {
|
|
|
1815
1907
|
|
|
1816
1908
|
interface FormatEnum {
|
|
1817
1909
|
avif: AvailableFormatInfo;
|
|
1910
|
+
dcraw: AvailableFormatInfo;
|
|
1818
1911
|
dz: AvailableFormatInfo;
|
|
1912
|
+
exr: AvailableFormatInfo;
|
|
1819
1913
|
fits: AvailableFormatInfo;
|
|
1820
1914
|
gif: AvailableFormatInfo;
|
|
1821
1915
|
heif: AvailableFormatInfo;
|
|
@@ -1829,6 +1923,7 @@ declare namespace sharp {
|
|
|
1829
1923
|
pdf: AvailableFormatInfo;
|
|
1830
1924
|
png: AvailableFormatInfo;
|
|
1831
1925
|
ppm: AvailableFormatInfo;
|
|
1926
|
+
rad: AvailableFormatInfo;
|
|
1832
1927
|
raw: AvailableFormatInfo;
|
|
1833
1928
|
svg: AvailableFormatInfo;
|
|
1834
1929
|
tiff: AvailableFormatInfo;
|