code: def _load_pil_image(self, filename):
          
          self._channel_data = []
          self._original_channel_data = []
  
          im = Image.open(filename)
          self._image = ImageOps.grayscale(im)
          im.load()
  
          file_data = np.asarray(im, float)
          file_data = file_data / file_data.max()
  
          # if the image has more than one channel, load them
          if( len(file_data.shape) == 3 ):
              num_channels = file_data.shape[2]
              for i in range(num_channels):
                  self._channel_data.append( file_data[:, :, i])
                  self._original_channel_data.append( file_data[:, :, i] )
docs: Load image using PIL.