code: def stretch_pattern(image_source):
      """!
      @brief Returns stretched content as 1-dimension (gray colored) matrix with size of input image.
  
      @param[in] image_source (Image): PIL Image instance.
  
      @return (list, Image) Stretched image as gray colored matrix and source image.
  
      """
      wsize, hsize = image_source.size
  
      # Crop digit exactly
      (ws, hs, we, he) = gray_pattern_borders(image_source)
      image_source = image_source.crop((ws, hs, we, he))
  
      # Stretch it to initial sizes
      image_source = image_source.resize(
          (wsize, hsize), Image.ANTIALIAS
      )
  
      # Transform image to simple array
      data = [pixel for pixel in image_source.getdata()]
      image_pattern = rgb2gray(data)
  
      return image_pattern, image_source
  
imports: import time
  import numpy
  from numpy import array
  from PIL import Image
  import matplotlib.pyplot
  from sys import platform
  from pyclustering.utils.metric import distance_metric, type_metric
label_desc: Use image node_id 5 for calling a global function with example usage: stretch_pattern(image_source) and returns: image_pattern,  image_source