code: def getimage(photo):
      """Copies the contents of a PhotoImage to a PIL image memory."""
      im = Image.new("RGBA", (photo.width(), photo.height()))
      block = im.im
  
      _pyimagingtkcall("PyImagingPhotoGet", photo, block.id)
  
      return im
  
imports: from __future__ import annotations
  import tkinter
  from io import BytesIO
  from .None import Image
label_desc: Use image node_id 4 for calling a global function with example usage: getimage(photo) and returns: im