1. A method comprising: receiving, by a processing device, an image of a document; transforming the image to a binarized image by performing a binarization operation on the image; identifying a portion of the binarized image that comprises one or more rows of textual content; identifying a plurality of horizontal runs of white pixels in the one or more rows of textual content in the portion of the binarized image, and a plurality of vertical runs of white pixels in the one or more rows of textual content in the portion of the binarized image; generating a first histogram for the plurality of horizontal runs of white pixels, and a second histogram for the plurality of vertical runs of white pixels; and determining, by the processing device, an orientation of the one or more rows of textual content in the image based on the first histogram and the second histogram.