code: def set_page_image(p, imgfile_src, imgfile_target=None):
      """
      For a page <p>, set the path to an image <imgfile>.
      Modifies <p> in-place.
      """
      if not imgfile_target:
          imgfile_target = imgfile_src
  
      p["image"] = imgfile_target
  
      img_size = get_image_size(imgfile_src)
      if not img_size:
          raise ValueError(
              "could not determine image size of file `%s`"
              % imgfile_src
          )
  
      ET.SubElement(
          p["xmlnode"],
          "image",
          dict(
              src=imgfile_target,
              top="0",
              left="0",
              width=str(img_size[0]),
              height=str(img_size[1]),
          ),
      )
  
imports: import xml.etree.ElementTree
  from collections import OrderedDict
  import json
  import struct
  import imghdr
  import numpy
  from .geom import pt, rect
label_desc: Use image node_id 4 for calling a global function with example usage: set_page_image(p, imgfile_src, imgfile_target) without return types