Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add lightness option to modulate #2846

Closed
wants to merge 2 commits into from
Closed

Feature: Add lightness option to modulate #2846

wants to merge 2 commits into from

Conversation

Tenpi
Copy link
Contributor

@Tenpi Tenpi commented Aug 17, 2021

This adds a lightness option to modulate in order to more closely mimic Photoshop's lightness adjustment. It does this by adding the provided value to the luminance channel instead of multiplying by it. Related to my earlier feature request (#2845).

Image Example:

2021-08-16-23-03-11_1

Code Example:

await sharp(image)
      .modulate({lightness: 10})
      .toBuffer()

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 99.9% when pulling 406bf5e on Tenpi:lightness into 7467fa8 on lovell:master.

@lovell
Copy link
Owner

lovell commented Aug 20, 2021

Thank you very much for this, it looks great.

Is it worth adding a sentence to the JSDocs to clarify that lightness is additive whereas brightness is multiplicative?

Please can you add a unit test for the new error handling path too.

@Tenpi
Copy link
Contributor Author

Tenpi commented Aug 21, 2021

Please can you add a unit test for the new error handling path too.

Do you mean adding it to the "invalid options" test? If so, I have updated it.

lovell added a commit that referenced this pull request Aug 30, 2021
@lovell
Copy link
Owner

lovell commented Aug 30, 2021

Landed via commit 4a9267c, thank you. This will be in v0.29.1

@lovell lovell closed this Aug 30, 2021
@lovell lovell added this to the v0.29.1 milestone Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants