-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Brightness, Saturation and Hue #609
Comments
Hello, *magick's "modulate" operator is approximately equivalent to a colourspace conversion to LCH (Luminance, Chroma, Hue) then a multiplication of pixels in the L and C channels. libvips supports these operations, but this is not currently exposed in sharp. As always, I'm happy to accept a PR and help with discussions about how the API for this might work. |
I would like to work on this. Can you point me to some resource which teaches about how can this be done? |
@adityapatadia Thanks for your interest. This feature will involve a combination of converting to the LCH colourspace via colourspace, splitting out any channels to be "modulated", using multiply to modify them with the relevant value before joining the channels back up again. You probably won't need to worry about the colourspace conversion away from LCH as there's already logic to clean up at the end of the pipeline.
The API could look something like: // identity transform, 100 means 100% of the original value so no change
.modulate({ brightness: 100, saturation: 100 }) // reduce saturation by ~25%
.modulate({ saturation: 75 }) // convert red to green etc.
.modulate({ hue: 166 }) |
I would be asking much more questions. |
@adityapatadia Although it's marked |
Hi @lovell I looked through the files and for example the |
@jonathan-kosgei Thank you for the offer of help. sharp uses libvips C++ API Your idea to start with an existing operation such as blur is a good idea. Perhaps follow https://github.com/lovell/sharp/search?q=blurSigma&type=Code https://github.com/lovell/sharp/blob/master/lib/operation.js#L180 I'm always happy to help with and provide feedback on partially-complete PRs. |
v0.22.1 now available with this feature. |
Hi @lovell,
Does sharp support brightness, saturation and hue?
I was looking for something similar to
modulate
of imagemagick or graphicsmagick.I took a look at the docs but could not find.
The text was updated successfully, but these errors were encountered: