code: def load(input_filename):
  
      '''Load an image with Pillow and convert it to numpy array. Also
  returns the image DPI in x and y as a tuple.'''
  
      try:
          pil_img = Image.open(input_filename)
      except IOError:
          sys.stderr.write('warning: error opening {}\n'.format(
              input_filename))
          return None, None
  
      if pil_img.mode != 'RGB':
          pil_img = pil_img.convert('RGB')
  
      if 'dpi' in pil_img.info:
          dpi = pil_img.info['dpi']
      else:
          dpi = (300, 300)
  
      img = np.array(pil_img)
  
      return img, dpf load(input_filename):
  
      '''Load an image with Pillow and convert it to numpy array. Also
  returns the image DPI in x and y as a tuple.'''
  
      try:
          pil_img = Image.open(input_filename)
      except IOError:
          sys.stderr.write('warning: error opening {}\n'.format(
              input_filename))
          return None, None
  
      if pil_img.mode != 'RGB':
          pil_img = pil_img.convert('RGB')
  
      if 'dpi' in pil_img.info:
          dpi = pil_img.info['dpi']
      else:
          dpi = (300, 300)
  
      img = np.array(pil_img)
  
      return img, dpi
docs: Load an image with Pillow and convert it to numpy array. Also
  returns the image DPI in x and y as a tuple.