Add lightness option to modulate operation

This commit is contained in:
Tenpi
2021-08-16 22:50:17 -04:00
committed by Lovell Fuller
parent 104464c2e0
commit 4a9267ce12
10 changed files with 62 additions and 13 deletions

View File

@@ -400,7 +400,9 @@ Returns **Sharp**
## modulate
Transforms the image using brightness, saturation and hue rotation.
Transforms the image using brightness, saturation, hue rotation, and lightness.
Brightness and lightness both operate on luminance, with the difference being that
brightness is multiplicative whereas lightness is additive.
### Parameters
@@ -409,13 +411,14 @@ Transforms the image using brightness, saturation and hue rotation.
* `options.brightness` **[number][1]?** Brightness multiplier
* `options.saturation` **[number][1]?** Saturation multiplier
* `options.hue` **[number][1]?** Degrees for hue rotation
* `options.lightness` **[number][1]?** Lightness addend
### Examples
```javascript
sharp(input)
.modulate({
brightness: 2 // increase lightness by a factor of 2
brightness: 2 // increase brightness by a factor of 2
});
sharp(input)
@@ -423,6 +426,11 @@ sharp(input)
hue: 180 // hue-rotate by 180 degrees
});
sharp(input)
.modulate({
lightness: 50 // increase lightness by +50
});
// decreate brightness and saturation while also hue-rotating by 90 degrees
sharp(input)
.modulate({

File diff suppressed because one or more lines are too long