code: def preload(self, path, image_shape, normalize=True, grayscale=False):
      img = load_image(path)
      width, height = img.size
      if width != image_shape[0] or height != image_shape[1]:
          img = resize_image(img, image_shape[0], image_shape[1])
      if grayscale:
          img = convert_color(img, "L")
      img = pil_to_nparray(img)
      if grayscale:
          img = np.reshape(img, img.shape + (1,))
      if normalize:
          img /= 255.0
      return img
  
imports: from __future__ import division, print_function, absolute_import
  import os
  import random
  import numpy
  from PIL import Image
  import pickle
  import csv
  import warnings
  import tensorflow.compat.v1
  from io import BytesIO
label_desc: Use image node_id 2 for calling the ImagePreloader obj's underlying member method code with example usage: obj.preload(path, image_shape, normalize, grayscale) and returns: img