title: Pytesseract doesn't accept pyautogui screenshot, Windows, Python 3.6
body: <p>What I'm trying to do is to make a screenshot of a number with pyautogui and tranform the number to a string with pytesseract. The code:
      import pyautogui
      import time
      import PIL
      from PIL import Image
      import pytesseract</p>
  
  <pre><code>pytesseract.pytesseract.tesseract_cmd = 'C://Program Files (x86)//Tesseract-OCR//tesseract'
  
  # Create image
  time.sleep(5)
  image = pyautogui.screenshot('projects/output.png', region=(1608, 314, 57, 41))
  
  # Resize image
  basewidth = 2000
  img = Image.open('projects/output.png')
  wpercent = (basewidth/float(img.size[0]))
  hsize = int((float(img.size[1])*float(wpercent)))
  img = img.resize((basewidth,hsize), PIL.Image.ANTIALIAS)
  img.save('projects/output.png')
  
  col = Image.open('projects/output.png')
  gray = col.convert('L')
  bw = gray.point(lambda x: 0 if x&lt;128 else 255, '1')
  bw.save('projects/output.png')
  
  # Image to string
  screen = Image.open('projects/output.png')
  
  print(pytesseract.image_to_string(screen, config='tessedit_char_whitelist=0123456789'))
  </code></pre>
  
  <p>Now it seems that pytesseract doesn't accept the screenshot pyautogui creates. The code runs fine without problems but prints an empty string. If I create an image in paint however, and save it as 'output.png' to the correct folder exactly like the screenshot otherwise made, it does work.</p>
  
  <p><a href="https://i.stack.imgur.com/LJezn.png" rel="nofollow noreferrer">Image output after resize and adjustments</a></p>
  
  <p>Anyone has an idea where I'm missing something?</p>