title: Is it possible to check orientation of an image before passing it through pytesseract ocr module
body: <p>For my current ocr project I tried using tesserect using the the python cover pytesseract for converting images into text files. Up till now I was only passing well straight oriented images into my module at it was able to properly figure out text in that image. But now as I am passing rotated images it is not able recognize even a single word. So to get good result I need to pass images only with proper orientation. 
  Now I want to know that is there any method to figure out the orientation of an image before passing it in ocr module. Please let me know what methods can I used to do that orientation check.</p>
  
  <p>This is the method which I am using to do conversion:</p>
  
  <pre><code>def images_to_text(testImg):
      print('Reading images form the directory..........')
      dataFile=[]
      for filename in os.listdir(testImg):
          os.chdir(testImg)
          # Define config parameters.
          # '-l eng'  for using the English language 
          # '--oem 1' for using LSTM OCR Engine
          config = ('-l eng --oem 1 --psm 3')
          # Read image from disk
          im = cv2.imread(str(filename), cv2.IMREAD_COLOR)
          # Run tesseract OCR on image
          text = pytesseract.image_to_string(im, config=config)
          #basic preprocessing of the text
          text = text.replace('\t',' ')
          text= text.rstrip()
          text= text.lstrip()
          text = text.replace(' +',' ')
          text = text.replace('\n+','\n')
          text = text.replace('\n+ +',' ')
  
          #writing data to file
          os.chdir(imgTxt)
          rep=filename[-3:]
          name=filename.replace(rep,'txt')
          with open(name, 'w') as writeFile:
              writeFile.write("%s\n" % text)
          text = text.replace('\n',' ')
          dataFile.append(text)
      print('writing data to file done')    
      return dataFile
  </code></pre>