Skip to content

Commit

Permalink
Correct channel detection in MagickImage.blur
Browse files Browse the repository at this point in the history
  • Loading branch information
Peeterush committed Feb 5, 2024
1 parent 4a212a6 commit aec7af4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/magick-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,15 +1935,18 @@ export class MagickImage extends NativeInstance implements IMagickImage {
blur(channels: Channels): void;
blur(radius: number, sigma: number): void;
blur(radius: number, sigma: number, channels: Channels): void;
blur(radiusOrChannel?: number | Channels, sigmaOrUndefined?: number, channelsOrUndefined?: Channels): void {
blur(radiusOrChannels?: number | Channels, sigmaOrUndefined?: number, channelsOrUndefined?: Channels): void {
let radius = 0;
const sigma = this.valueOrDefault(sigmaOrUndefined, 1);
let channels = this.valueOrDefault(channelsOrUndefined, Channels.Undefined);

if (typeof radiusOrChannel === 'number')
radius = radiusOrChannel;
else if (radiusOrChannel !== undefined)
channels = radiusOrChannel;
if (radiusOrChannels !== undefined) {
if (sigmaOrUndefined === undefined) {
channels = radiusOrChannels;
} else {
radius = radiusOrChannels;
}
}

this.useException(exception => {
const instance = ImageMagick._api._MagickImage_Blur(this._instance, radius, sigma, channels, exception.ptr);
Expand Down

0 comments on commit aec7af4

Please sign in to comment.