Skip to content

Commit

Permalink
fix: Fixed adjusting of saturation and contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor-pelykh committed Apr 12, 2024
1 parent b07e9e1 commit eba6a92
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/filter/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ export abstract class Filter {
const maskChannel = opt.maskChannel ?? Channel.luminance;
const contrast =
opt.contrast !== undefined
? MathUtils.clamp(opt.contrast, 0, 1)
? MathUtils.clamp(opt.contrast, 0, 2)
: undefined;
const saturation =
opt.saturation !== undefined
? MathUtils.clamp(opt.saturation, 0, 1)
? MathUtils.clamp(opt.saturation, 0, 2)
: undefined;
const brightness =
opt.brightness !== undefined ? opt.brightness : undefined;
Expand Down Expand Up @@ -448,9 +448,9 @@ export abstract class Filter {
}

const invSaturation =
saturation !== undefined ? 1 - MathUtils.clamp(saturation, 0, 1) : 0;
saturation !== undefined ? 1 - MathUtils.clamp(saturation, 0, 2) : 0;
const invContrast =
contrast !== undefined ? 1 - MathUtils.clamp(contrast, 0, 1) : 0;
contrast !== undefined ? 1 - MathUtils.clamp(contrast, 0, 2) : 0;

if (exposure !== undefined) {
exposure = Math.pow(2, exposure);
Expand Down

0 comments on commit eba6a92

Please sign in to comment.