title: Python - Read number in image with Pytesseract
body: <p>I am using a combination of pyautogui and pytesseract to capture small regions on the screen and then pull the number/text out of the region.  I have written script that has read the majority of captured images perfectly, but single digit numbers seem to cause an issue for it.  For example small regions of an image containing numbers are saved to .png files the numbers 11, 14, and 18 were pulled perfectly, but the number 7 is just returning as a blank string.</p>
  
  <p><strong>Question:</strong>  What could be causing this to happen?</p>
  
  <p><strong>Code:</strong> Scaled down drastically to make it every easy to follow:</p>
  
  <pre><code>def get_text(image):
      return pytesseract.image_to_string(image)
  
  answer2 = pyautogui.screenshot('answer2.png',region=(727, 566, 62, 48))
  img = Image.open('answer2.png')
  answer2 = get_text(img)
  </code></pre>
  
  <p>This code is repeated 4 times, once for each image, it worked for 11,14,18 but not for 7.  </p>
  
  <p>Just to slow the files being read here is a screenshot of the images after they were saved through the screenshot command.</p>
  
  <p><a href="https://gyazo.com/0acbf5be2d970abeb29561113c171fbe" rel="nofollow noreferrer">https://gyazo.com/0acbf5be2d970abeb29561113c171fbe</a></p>
  
  <p>here is a screenshot of what I am working from:</p>
  
  <p><a href="https://gyazo.com/311913217a1302382b700b07ad3e3439" rel="nofollow noreferrer">https://gyazo.com/311913217a1302382b700b07ad3e3439</a></p>