use leptonica, that's it.