Question: A lot of questions include photographs of writing on paper (equations, diagrams, etc.) that were hastily taken in poor and/or uneven lighting. Is there a straightforward way to improve them?

Answer: 
Yes, there is.

I have created a procedure based on [ImageMagick](https://www.imagemagick.org/script/index.php) that seems to do a good job. You can see examples here: [original](https://i.stack.imgur.com/gSyOf.jpg) vs [improved](https://i.stack.imgur.com/i9eVP.jpg), and also [here](https://electronics.stackexchange.com/q/347350/11683) ([original](https://i.stack.imgur.com/XGU75.jpg) vs [improved](https://i.stack.imgur.com/ExHYT.png)).

The process is to first crop the image to remove all extraneous stuff outside the boundaries of the paper. For example, on the second one, I used:

```
convert -crop 3456x2000+0+1800 XGU75.jpg XGU75_a.jpg

```

Then, the following command uses a blurred copy of the image to approximate the lighting with the text and diagrams removed. This copy is negated and added to the original image in order to cancel out the effects of the uneven lighting, and then the contrast is stretched (normalized):

```
convert XGU75_a.jpg \( +clone -blur 30x30 -negate \) -compose Plus -composite -normalize XGU75_b.jpg

```

Finally, in some cases, it makes sense to convert the result to a binary (black and white rather than grayscale) PNG, which greatly reduces the file size:

```
convert -threshold 50000 XGU75_b.jpg XGU75_b.png

```

YMMV. Tweak the parameters as needed.
I think you are going in the wrong direction here. 

Since we have tools for both diagrams & equations, why not remove those pictures alltogether and replace them with the right tools? 

To take it a step further, i believe we should enforce that as a rule, i do not want to decipher an equation or a diagram on a crappy picture when the site provides good tools to write very clear ones.

Besides, it is not *that* hard to take a decent-quality picture of a diagram.