https://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-4-brightness-adjustment/
Image Processing Algorithms Part 4: Brightness Adjustment