diff --git a/README.md b/README.md index efa93792..928225de 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ You can universally customize IPX configuration using `IPX_*` environment variab | tint | [Docs](https://sharp.pixelplumbing.com/api-colour#tint) | `/tint_1098123/buffalo.png` | | grayscale | [Docs](https://sharp.pixelplumbing.com/api-colour#grayscale) | `/grayscale/buffalo.png` | | flatten | [Docs](https://sharp.pixelplumbing.com/api-operation#flatten) | `/flatten/buffalo.png` | Remove alpha channel, if any, and replace with background colour. | -| modulate | [Docs](https://sharp.pixelplumbing.com/api-operation#modulate) | `/modulate_brightness_saturation_hue/buffalo.png` | Transforms the image using brightness, saturation and hue rotation. | +| modulate | [Docs](https://sharp.pixelplumbing.com/api-operation#modulate) | `/modulate_{brightness}_{saturation}_{hue}_{lightness}/buffalo.png` | Transforms the image using brightness, saturation, hue rotation and lightness. | | crop | [Docs](https://sharp.pixelplumbing.com/api-resize#extract) | `/crop_{left}_{top}_{width}_{height}/buffalo.png` | Alias for extract. Extract/crop a region of the image. | | animated / a | - | `/animated/buffalo.gif` or `/a/buffalo.gif` | Experimental | diff --git a/src/handlers/handlers.ts b/src/handlers/handlers.ts index 0c19dc3c..d50bec1c 100644 --- a/src/handlers/handlers.ts +++ b/src/handlers/handlers.ts @@ -240,12 +240,13 @@ export const threshold: Handler = { // https://sharp.pixelplumbing.com/api-operation#modulate export const modulate: Handler = { - args: [VArg], - apply: (_context, pipe, brightness, saturation, hue) => { + args: [VArg, VArg, VArg, VArg], + apply: (_context, pipe, brightness, saturation, hue, lightness) => { return pipe.modulate({ brightness, saturation, hue, + lightness, }); }, }; diff --git a/test/handlers/handlers.test.ts b/test/handlers/handlers.test.ts index b99b5764..83f5a3d3 100644 --- a/test/handlers/handlers.test.ts +++ b/test/handlers/handlers.test.ts @@ -313,12 +313,13 @@ describe("handlers", () => { modulate: vi.fn(), }; - modulate.apply({} as any, sharpMock as any, 100, 200, 300); + modulate.apply({} as any, sharpMock as any, 100, 200, 300, 400); expect(sharpMock.modulate).toHaveBeenCalledWith({ brightness: 100, saturation: 200, hue: 300, + lightness: 400, }); });