My first question on this forum, please be soft with me :)
I have a bunch of BMP files (created by the script i wrote ) and i would like to change the color level of them. Currently, i open Gimp, i go to "color level" set the input level values from 0~255 to 200~255 , i click "ok" and i get what i want. But i would like to understand what is the algorithm behind that, so that i can code it. I tried to search , i read the Gimp documentation but i did not find enough information. If someone could help, that would be great !
Thanks a lot for you help :)
The first googled ling shows documentation https://docs.gimp.org/en/gimp-tool-levels.html
If you don't need gamma correction (middle slider), use simple linear transformation, where V and NV is old value and new (corrected) value for ever color channel (R, G, B), L and H are Low and High levels.
NV = Min(255, Max(0, (V - L) * 255 / (H - L)))