title: SystemError: <built-in function imread> returned NULL without setting an error
body: <p>I don't know what the problem in this code. I am just trying to read the user input image to imread.</p>
  <p>Code:</p>
  <pre><code>    root = tk.Tk()
      #root.withdraw()
      root.geometry('600x400')
      def file():
          file = askopenfile(mode ='rb', filetypes =[('JPG File', '*.jpg'),('PNG File','*.png')])
          if file is not None:
              content = file.read()
              print(content)
  
  
  open = tk.Button(root, text =&quot;Open Image&quot;,command= lambda : file())
  open.pack()
  
  
  pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
  
  img = cv2.imread(file, cv2.IMREAD_COLOR)
  img = cv2.resize(img, (600, 400))
  </code></pre>
  <p>Error:-</p>
  <pre><code> img = cv2.imread(file, cv2.IMREAD_COLOR)
  
  SystemError: &lt;built-in function imread&gt; returned NULL without setting an error
  </code></pre>