Expose optional precision parameter of blur operation (#4168)

This commit is contained in:
Marcos Casagrande
2024-07-20 14:53:23 +02:00
committed by GitHub
parent 10c6f474d9
commit 67a4592756
10 changed files with 103 additions and 15 deletions

11
lib/index.d.ts vendored
View File

@@ -464,7 +464,7 @@ declare namespace sharp {
* @throws {Error} Invalid parameters
* @returns A sharp instance that can be used to chain operations
*/
blur(sigma?: number | boolean): Sharp;
blur(sigma?: number | boolean | BlurOptions): Sharp;
/**
* Merge alpha transparency channel, if any, with background.
@@ -1342,6 +1342,15 @@ declare namespace sharp {
background?: Color | undefined;
}
type Precision = 'integer' | 'float' | 'approximate';
interface BlurOptions {
/** A value between 0.3 and 1000 representing the sigma of the Gaussian mask, where `sigma = 1 + radius / 2` */
sigma: number;
/** How accurate the operation should be, one of: integer, float, approximate. (optional, default "integer") */
precision?: Precision | undefined;
}
interface FlattenOptions {
/** background colour, parsed by the color module, defaults to black. (optional, default {r:0,g:0,b:0}) */
background?: Color | undefined;