Skip to content

Commit 1b2f793

Browse files
committed
Remove previously-deprecated properties from API
1 parent 9371679 commit 1b2f793

13 files changed

Lines changed: 31 additions & 134 deletions

File tree

docs/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
"astro": "astro"
1212
},
1313
"dependencies": {
14-
"@astrojs/starlight": "^0.36.2",
15-
"astro": "^5.15.3",
16-
"starlight-auto-sidebar": "^0.1.3"
14+
"@astrojs/starlight": "^0.37.1",
15+
"astro": "^5.16.6",
16+
"jsdoc-to-markdown": "^9.1.3",
17+
"starlight-auto-sidebar": "^0.1.4"
1718
}
1819
}

docs/src/content/docs/api-operation.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ inputStream
170170

171171

172172
## sharpen
173-
> sharpen([options], [flat], [jagged]) ⇒ <code>Sharp</code>
173+
> sharpen([options]) ⇒ <code>Sharp</code>
174174
175175
Sharpen the image.
176176

@@ -189,15 +189,13 @@ See [libvips sharpen](https://www.libvips.org/API/current/method.Image.sharpen.h
189189

190190
| Param | Type | Default | Description |
191191
| --- | --- | --- | --- |
192-
| [options] | <code>Object</code> \| <code>number</code> | | if present, is an Object with attributes |
192+
| [options] | <code>Object</code> | | if present, is an Object with attributes |
193193
| [options.sigma] | <code>number</code> | | the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10 |
194194
| [options.m1] | <code>number</code> | <code>1.0</code> | the level of sharpening to apply to "flat" areas, between 0 and 1000000 |
195195
| [options.m2] | <code>number</code> | <code>2.0</code> | the level of sharpening to apply to "jagged" areas, between 0 and 1000000 |
196196
| [options.x1] | <code>number</code> | <code>2.0</code> | threshold between "flat" and "jagged", between 0 and 1000000 |
197197
| [options.y2] | <code>number</code> | <code>10.0</code> | maximum amount of brightening, between 0 and 1000000 |
198198
| [options.y3] | <code>number</code> | <code>20.0</code> | maximum amount of darkening, between 0 and 1000000 |
199-
| [flat] | <code>number</code> | | (deprecated) see `options.m1`. |
200-
| [jagged] | <code>number</code> | | (deprecated) see `options.m2`. |
201199

202200
**Example**
203201
```js
@@ -360,8 +358,6 @@ with all white pixel values made fully transparent.
360358

361359
Existing alpha channel values for non-white pixels remain unchanged.
362360

363-
This feature is experimental and the API may change.
364-
365361

366362
**Since**: 0.32.1
367363
**Example**

docs/src/content/docs/api-output.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,8 +740,7 @@ Use these AVIF options for output image.
740740
AVIF image sequences are not supported.
741741
Prebuilt binaries support a bitdepth of 8 only.
742742

743-
This feature is experimental on the Windows ARM64 platform
744-
and requires a CPU with ARM64v8.4 or later.
743+
When using Windows ARM64, this feature requires a CPU with ARM64v8.4 or later.
745744

746745

747746
**Throws**:

docs/src/content/docs/changelog/v0.35.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ slug: changelog/v0.35.0
88
* Breaking: Remove `install` script from `package.json` file.
99
Compiling from source is now opt-in via the `build` script.
1010

11+
* Breaking: Remove deprecated `failOnError` constructor property.
12+
13+
* Breaking: Remove deprecated `paletteBitDepth` from `metadata` response.
14+
15+
* Breaking: Remove deprecated properties from `sharpen` operation.
16+
1117
* Upgrade to libvips v8.18.0 for upstream bug fixes.
1218

1319
* Add `withGainMap` to process HDR JPEG images with embedded gain maps.

lib/index.d.ts

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ declare namespace sharp {
259259
* Set the pipeline colourspace.
260260
* The input image will be converted to the provided colourspace at the start of the pipeline.
261261
* All operations will use this colourspace before converting to the output colourspace, as defined by toColourspace.
262-
* This feature is experimental and has not yet been fully-tested with all operations.
263262
*
264263
* @param colourspace pipeline colourspace e.g. rgb16, scrgb, lab, grey16 ...
265264
* @throws {Error} Invalid parameters
@@ -470,21 +469,6 @@ declare namespace sharp {
470469
*/
471470
sharpen(options?: SharpenOptions): Sharp;
472471

473-
/**
474-
* Sharpen the image.
475-
* When used without parameters, performs a fast, mild sharpen of the output image.
476-
* When a sigma is provided, performs a slower, more accurate sharpen of the L channel in the LAB colour space.
477-
* Fine-grained control over the level of sharpening in "flat" (m1) and "jagged" (m2) areas is available.
478-
* @param sigma the sigma of the Gaussian mask, where sigma = 1 + radius / 2.
479-
* @param flat the level of sharpening to apply to "flat" areas. (optional, default 1.0)
480-
* @param jagged the level of sharpening to apply to "jagged" areas. (optional, default 2.0)
481-
* @throws {Error} Invalid parameters
482-
* @returns A sharp instance that can be used to chain operations
483-
*
484-
* @deprecated Use the object parameter `sharpen({sigma, m1, m2, x1, y2, y3})` instead
485-
*/
486-
sharpen(sigma?: number, flat?: number, jagged?: number): Sharp;
487-
488472
/**
489473
* Apply median filter. When used without parameters the default window is 3x3.
490474
* @param size square mask size: size x size (optional, default 3)
@@ -910,7 +894,7 @@ declare namespace sharp {
910894
* - sharp.gravity: north, northeast, east, southeast, south, southwest, west, northwest, center or centre.
911895
* - sharp.strategy: cover only, dynamically crop using either the entropy or attention strategy. Some of these values are based on the object-position CSS property.
912896
*
913-
* The experimental strategy-based approach resizes so one dimension is at its target length then repeatedly ranks edge regions,
897+
* The strategy-based approach resizes so one dimension is at its target length then repeatedly ranks edge regions,
914898
* discarding the edge with the lowest score based on the selected strategy.
915899
* - entropy: focus on the region with the highest Shannon entropy.
916900
* - attention: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.
@@ -999,14 +983,6 @@ declare namespace sharp {
999983
* 'none' (least), 'truncated', 'error' or 'warning' (most), highers level imply lower levels, invalid metadata will always abort. (optional, default 'warning')
1000984
*/
1001985
failOn?: FailOnOptions | undefined;
1002-
/**
1003-
* By default halt processing and raise an error when loading invalid images.
1004-
* Set this flag to false if you'd rather apply a "best effort" to decode images,
1005-
* even if the data is corrupt or invalid. (optional, default true)
1006-
*
1007-
* @deprecated Use `failOn` instead
1008-
*/
1009-
failOnError?: boolean | undefined;
1010986
/**
1011987
* Do not process input images where the number of pixels (width x height) exceeds this limit.
1012988
* Assumes image dimensions contained in the input metadata can be trusted.
@@ -1308,11 +1284,11 @@ declare namespace sharp {
13081284
channels: ChannelStats[];
13091285
/** Value to identify if the image is opaque or transparent, based on the presence and use of alpha channel */
13101286
isOpaque: boolean;
1311-
/** Histogram-based estimation of greyscale entropy, discarding alpha channel if any (experimental) */
1287+
/** Histogram-based estimation of greyscale entropy, discarding alpha channel if any */
13121288
entropy: number;
1313-
/** Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any (experimental) */
1289+
/** Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any */
13141290
sharpness: number;
1315-
/** Object containing most dominant sRGB colour based on a 4096-bin 3D histogram (experimental) */
1291+
/** Object containing most dominant sRGB colour based on a 4096-bin 3D histogram */
13161292
dominant: { r: number; g: number; b: number };
13171293
}
13181294

lib/input.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const inputStreamParameters = [
3030
// Format-specific
3131
'jp2', 'openSlide', 'pdf', 'raw', 'svg', 'tiff',
3232
// Deprecated
33-
'failOnError', 'openSlideLevel', 'pdfBackground', 'tiffSubifd'
33+
'openSlideLevel', 'pdfBackground', 'tiffSubifd'
3434
];
3535

3636
/**
@@ -106,14 +106,6 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
106106
}`);
107107
}
108108
if (is.object(inputOptions)) {
109-
// Deprecated: failOnError
110-
if (is.defined(inputOptions.failOnError)) {
111-
if (is.bool(inputOptions.failOnError)) {
112-
inputDescriptor.failOn = inputOptions.failOnError ? 'warning' : 'none';
113-
} else {
114-
throw is.invalidParameterError('failOnError', 'boolean', inputOptions.failOnError);
115-
}
116-
}
117109
// failOn
118110
if (is.defined(inputOptions.failOn)) {
119111
if (is.string(inputOptions.failOn) && is.inArray(inputOptions.failOn, ['none', 'truncated', 'error', 'warning'])) {

lib/operation.js

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -259,45 +259,18 @@ function affine (matrix, options) {
259259
* })
260260
* .toBuffer();
261261
*
262-
* @param {Object|number} [options] - if present, is an Object with attributes
262+
* @param {Object} [options] - if present, is an Object with attributes
263263
* @param {number} [options.sigma] - the sigma of the Gaussian mask, where `sigma = 1 + radius / 2`, between 0.000001 and 10
264264
* @param {number} [options.m1=1.0] - the level of sharpening to apply to "flat" areas, between 0 and 1000000
265265
* @param {number} [options.m2=2.0] - the level of sharpening to apply to "jagged" areas, between 0 and 1000000
266266
* @param {number} [options.x1=2.0] - threshold between "flat" and "jagged", between 0 and 1000000
267267
* @param {number} [options.y2=10.0] - maximum amount of brightening, between 0 and 1000000
268268
* @param {number} [options.y3=20.0] - maximum amount of darkening, between 0 and 1000000
269-
* @param {number} [flat] - (deprecated) see `options.m1`.
270-
* @param {number} [jagged] - (deprecated) see `options.m2`.
271269
* @returns {Sharp}
272270
* @throws {Error} Invalid parameters
273271
*/
274-
function sharpen (options, flat, jagged) {
275-
if (!is.defined(options)) {
276-
// No arguments: default to mild sharpen
277-
this.options.sharpenSigma = -1;
278-
} else if (is.bool(options)) {
279-
// Deprecated boolean argument: apply mild sharpen?
280-
this.options.sharpenSigma = options ? -1 : 0;
281-
} else if (is.number(options) && is.inRange(options, 0.01, 10000)) {
282-
// Deprecated numeric argument: specific sigma
283-
this.options.sharpenSigma = options;
284-
// Deprecated control over flat areas
285-
if (is.defined(flat)) {
286-
if (is.number(flat) && is.inRange(flat, 0, 10000)) {
287-
this.options.sharpenM1 = flat;
288-
} else {
289-
throw is.invalidParameterError('flat', 'number between 0 and 10000', flat);
290-
}
291-
}
292-
// Deprecated control over jagged areas
293-
if (is.defined(jagged)) {
294-
if (is.number(jagged) && is.inRange(jagged, 0, 10000)) {
295-
this.options.sharpenM2 = jagged;
296-
} else {
297-
throw is.invalidParameterError('jagged', 'number between 0 and 10000', jagged);
298-
}
299-
}
300-
} else if (is.plainObject(options)) {
272+
function sharpen (options) {
273+
if (is.plainObject(options)) {
301274
if (is.number(options.sigma) && is.inRange(options.sigma, 0.000001, 10)) {
302275
this.options.sharpenSigma = options.sigma;
303276
} else {
@@ -339,7 +312,7 @@ function sharpen (options, flat, jagged) {
339312
}
340313
}
341314
} else {
342-
throw is.invalidParameterError('sigma', 'number between 0.01 and 10000', options);
315+
this.options.sharpenSigma = -1;
343316
}
344317
return this;
345318
}
@@ -510,8 +483,6 @@ function flatten (options) {
510483
*
511484
* Existing alpha channel values for non-white pixels remain unchanged.
512485
*
513-
* This feature is experimental and the API may change.
514-
*
515486
* @since 0.32.1
516487
*
517488
* @example

lib/output.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,7 @@ function tiff (options) {
11511151
* AVIF image sequences are not supported.
11521152
* Prebuilt binaries support a bitdepth of 8 only.
11531153
*
1154-
* This feature is experimental on the Windows ARM64 platform
1155-
* and requires a CPU with ARM64v8.4 or later.
1154+
* When using Windows ARM64, this feature requires a CPU with ARM64v8.4 or later.
11561155
*
11571156
* @example
11581157
* const data = await sharp(input)

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@
182182
"exif-reader": "^2.0.3",
183183
"extract-zip": "^2.0.1",
184184
"icc": "^3.0.0",
185-
"jsdoc-to-markdown": "^9.1.3",
186185
"node-addon-api": "^8.5.0",
187186
"node-gyp": "^12.1.0",
188187
"tar-fs": "^3.1.1",

src/metadata.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,6 @@ class MetadataWorker : public Napi::AsyncWorker {
190190
info.Set("isPalette", baton->isPalette);
191191
if (baton->bitsPerSample > 0) {
192192
info.Set("bitsPerSample", baton->bitsPerSample);
193-
if (baton->isPalette) {
194-
// Deprecated, remove with libvips 8.17.0
195-
info.Set("paletteBitDepth", baton->bitsPerSample);
196-
}
197193
}
198194
if (baton->pages > 0) {
199195
info.Set("pages", baton->pages);

0 commit comments

Comments
 (0)