class_docstr: A Tkinter-compatible photo image.  This can be used
  everywhere Tkinter expects an image object.  If the image is an RGBA
  image, pixels having alpha 0 are treated as transparent.
  
  The constructor takes either a PIL image, or a mode and a size.
  Alternatively, you can use the ``file`` or ``data`` options to initialize
  the photo image object.
  
  :param image: Either a PIL image, or a mode string.  If a mode string is
                used, a size must also be given.
  :param size: If the first argument is a mode string, this defines the size
               of the image.
  :keyword file: A filename to load the image from (using
                 ``Image.open(file)``).
  :keyword data: An 8-bit string containing image data (as loaded from an
                 image file).
class_docstr_tok: ["A","Tkinter-compatible","photo","image",".","This","can","be","used","everywhere","Tkinter","expects","an","image","object",".","If","the","image","is","an","RGBA","image",",","pixels","having","alpha","0","are","treated","as","transparent",".","The","constructor","takes","either","a","PIL","image",",","or","a","mode","and","a","size",".","Alternatively",",","you","can","use","the","``","file","``","or","``","data","``","options","to","initialize","the","photo","image","object",".",":","param","image",":","Either","a","PIL","image",",","or","a","mode","string",".","If","a","mode","string","is","used",",","a","size","must","also","be","given",".",":","param","size",":","If","the","first","argument","is","a","mode","string",",","this","defines","the","size","of","the","image",".",":","keyword","file",":","A","filename","to","load","the","image","from","(","using","``","Image.open","(","file",")","``",")",".",":","keyword","data",":","An","8-bit","string","containing","image","data","(","as","loaded","from","an","image","file",")","."]
code: def __init__(self, image=None, size=None, **kw):
      # Tk compatibility: file or data
      if image is None:
          image = _get_image_from_kw(kw)
  
      if hasattr(image, "mode") and hasattr(image, "size"):
          # got an image instead of a mode
          mode = image.mode
          if mode == "P":
              # palette mapped data
              image.load()
              try:
                  mode = image.palette.mode
              except AttributeError:
                  mode = "RGB"  # default
          size = image.size
          kw["width"], kw["height"] = size
      else:
          mode = image
          image = None
  
      if mode not in ["1", "L", "RGB", "RGBA"]:
          mode = Image.getmodebase(mode)
  
      self.__mode = mode
      self.__size = size
      self.__photo = tkinter.PhotoImage(**kw)
      self.tk = self.__photo.tk
      if image:
          self.paste(image)
  
file_path: pillow-simd/src/PIL/ImageTk.py
imports: import tkinter
  from io import BytesIO
  from .None import Image
label_desc: Use image node_id 1 to create a new PhotoImage object  with example: obj = PhotoImage(image, size)