Instagram added a Lux button recently, which allows auto-contrasting / leveling for the pictures you take.
I have a bunch of pictures that I need to autolevel in a simi
For those who haven't solved a linear equation in a very long time (such as I) here the required parameters from Adi Shavit's answer in a formula (in pseudo code) - I renamed p5
and p95
to p1
and p2
(as 5 is just a suggestion):
p_div := float(p1) / p2;
b := -255 * p_div / (1 - p_div);
a := (255 - b) / p2;
I don't know if it can be done easier, but you can check that:
a * p1 + b -> 0
a * p2 + b -> 255