code: def toImage(array, path="", mode=16):
      """
  
      Converts a one-dimensional array to a 2 dimensional image
  
      Args:
          array (array):
          path (str):
          ocvType (int):
  
      Returns:
          object: 2 dimensional image
      """
      length = np.prod(array.shape)
  
      data = bytearray(
          array.astype(dtype=np.int8)[:, :, (2, 1, 0)].reshape(length)
      )
      height = array.shape[0]
      width = array.shape[1]
      # Creating new Row with _create_row(), because Row(name = value, ... ) orders fields by name,
      # which conflicts with expected ImageSchema order when the new DataFrame is created by UDF
      return _create_row(
          ImageFields, [path, height, width, 3, mode, data]
      )
  
imports: import sys
  from typing import List
  import pyspark
  from pyspark import SparkContext
  from pyspark.ml.common import inherit_doc
  from pyspark.sql.types import *
  from pyspark.sql.types import Row, _create_row
  import numpy
  from synapse.ml.opencv._ImageTransformer import _ImageTransformer
  from pyspark.ml.common import inherit_doc
label_desc: Use image node_id 2 for calling a global function with example usage: toImage(array, path, mode) and returns: _create_row