Expose erode and dilate operations #4243

This commit is contained in:
Quentin Pinçon
2025-03-27 12:59:02 +00:00
committed by Lovell Fuller
parent 03e1b19764
commit 031c808aa5
17 changed files with 249 additions and 0 deletions

16
lib/index.d.ts vendored
View File

@@ -504,6 +504,22 @@ declare namespace sharp {
*/
blur(sigma?: number | boolean | BlurOptions): Sharp;
/**
* Expand foreground objects using the dilate morphological operator.
* @param {Number} [width=1] dilation width in pixels.
* @throws {Error} Invalid parameters
* @returns A sharp instance that can be used to chain operations
*/
dilate(width?: number): Sharp;
/**
* Shrink foreground objects using the erode morphological operator.
* @param {Number} [width=1] erosion width in pixels.
* @throws {Error} Invalid parameters
* @returns A sharp instance that can be used to chain operations
*/
erode(width?: number): Sharp;
/**
* Merge alpha transparency channel, if any, with background.
* @param flatten true to enable and false to disable (defaults to true)