code: def _extendToCanvas(canvas, add, point):
      x, y = point
      new_shape = tuple(
          np.max(
              [
                  np.add(
                      canvas.shape, -np.min([[y, x], [0, 0]], axis=0)
                  ),
                  np.add(add.shape, np.max([[y, x], [0, 0]], axis=0)),
              ],
              axis=0,
          )
      )
      out = np.full(new_shape, 255, dtype=np.uint8)
      c_start = 0 if y >= 0 else -y
      out[
          c_start : c_start + canvas.shape[0], : canvas.shape[1]
      ] = canvas
      y += c_start
      out[y : y + add.shape[0], x : x + add.shape[1]] = add
      return out
  
imports: from PIL import ImageFont, ImageDraw, Image
  import numpy
  import random
  from skimage.transform import rescale
  from enum import IntEnum
  from collections import namedtuple
  from typing import List
  import logging
  from calamari_ocr.ocr.dataset.datareader.generated_line_dataset import LineGeneratorParams
label_desc: Use image node_id 1 for calling a global function with example usage: _extendToCanvas(canvas, add, point) and returns: out