code: def read_img(img_path, img_type="RGB", h=None, w=None):
      """
      read img
      """
      img = Image.open(img_path).convert(img_type)
      if h is not None and w is not None:
          img = img.resize((w, h), resample=Image.NEAREST)
      img = np.array(img)
      if img.ndim == 2:
          img = np.expand_dims(img, axis=-1)
      img = img.transpose((2, 0, 1))
      img = paddle.to_tensor(img).unsqueeze(0).astype("float32") / 255.0
      return img
  
file_path: PaddleHub/modules/image/Image_gan/style_transfer/paint_transformer/render_utils.py
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  import cv2
  import numpy
  from PIL import Image
  import math
label_desc: Use image node_id 2 for calling a global function with example usage: read_img(img_path, img_type, h, w) and returns: img