A little test on how to "restore" image readability by using all of the color space up (0-255) grayscale.
By the way: image was taken from a SurveillancePi Raspberry Pi Camera System.
You will need to install Pillow (PIL fork) like this and clone the repository to your computer.
Then execute the python script with the input image path as an argument:
python3 main.py image.jpg
Supports all the formats that Pillow supports. Transparency should be avoided. The output file should be available at image-clamped.jpeg.