silvia-odwyer / photon

⚡ Rust/WebAssembly image processing library
https://silvia-odwyer.github.io/photon
Apache License 2.0
2.65k stars 151 forks source link

Gamma correction #111

Open osman-turan opened 2 years ago

osman-turan commented 2 years ago

At planned features, the gamma correction is listed. At the same time, the codebase has a commented-out piece of code for gamma correction. See: https://github.com/silvia-odwyer/photon/blob/475562b1e6594b994a32921f4f524138b648738e/crate/src/colour_spaces.rs#L10-L50

I haven't checked the correctness of the commented-out function. Why is it commented-out? What's the expectation and plan for the gamma correction? I can work on this feature if you like.

silvia-odwyer commented 2 years ago

@osman-turan Hi Osman, Thanks for opening this issue and for your interest in working on a gamma correction function!

The current gamma correction code uses features in the image library that are now deprecated, namely accessing the data field of each pixel, hence why the code is commented out. As for the correctness of the algorithm, I haven't been able to test it due to the deprecated code, so it might be better to start a new function and work on the implementation there.

But that said, if you'd like to work on your own function or make use of the logic in this, it's completely up to you! 😄 Thanks again for the help, it's greatly appreciated!

osman-turan commented 2 years ago

Thanks for the details! Due to rounding, there might be some edge cases at my implementation. If you encounter such inputs, please let me know so that I can work on a fix.