To get better document pictures I suggest to implement an edge enhancement algotithm, that would also allow PNG compression of image if black and white.
Something like is implemented in open document scanner
By the way, this app works very well in detecting the edges of the document. thank you for the good work