class_docstr: A Windows bitmap with the given mode and size.  The mode can be one of "1",
  "L", "P", or "RGB".
  
  If the display requires a palette, this constructor creates a suitable
  palette and associates it with the image. For an "L" image, 128 graylevels
  are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
  with 20 graylevels.
  
  To make sure that palettes work properly under Windows, you must call the
  ``palette`` method upon certain events from Windows.
  
  :param image: Either a PIL image, or a mode string. If a mode string is
                used, a size must also be given.  The mode can be one of "1",
                "L", "P", or "RGB".
  :param size: If the first argument is a mode string, this
               defines the size of the image.
class_docstr_tok: ["A","Windows","bitmap","with","the","given","mode","and","size",".","The","mode","can","be","one","of","``","1","''",",","''","L","''",",","``","P","''",",","or","``","RGB","''",".","If","the","display","requires","a","palette",",","this","constructor","creates","a","suitable","palette","and","associates","it","with","the","image",".","For","an","``","L","''","image",",","128","graylevels","are","allocated",".","For","an","``","RGB","''","image",",","a","6x6x6","colour","cube","is","used",",","together","with","20","graylevels",".","To","make","sure","that","palettes","work","properly","under","Windows",",","you","must","call","the","``","palette","``","method","upon","certain","events","from","Windows",".",":","param","image",":","Either","a","PIL","image",",","or","a","mode","string",".","If","a","mode","string","is","used",",","a","size","must","also","be","given",".","The","mode","can","be","one","of","``","1","''",",","``","L","''",",","``","P","''",",","or","``","RGB","''",".",":","param","size",":","If","the","first","argument","is","a","mode","string",",","this","defines","the","size","of","the","image","."]
docstr: Paste a PIL image into the bitmap image.
  
  :param im: A PIL image.  The size must match the target region.
             If the mode does not match, the image is converted to the
             mode of the bitmap image.
  :param box: A 4-tuple defining the left, upper, right, and
              lower pixel coordinate.  See :ref:`coordinate-system`. If
              None is given instead of a tuple, all of the image is
              assumed.
docstr_tok: ["Paste","a","PIL","image","into","the","bitmap","image",".",":","param","im",":","A","PIL","image",".","The","size","must","match","the","target","region",".","If","the","mode","does","not","match",",","the","image","is","converted","to","the","mode","of","the","bitmap","image",".",":","param","box",":","A","4-tuple","defining","the","left",",","upper",",","right",",","and","lower","pixel","coordinate",".","See",":","ref",":","`","coordinate-system","`",".","If","None","is","given","instead","of","a","tuple",",","all","of","the","image","is","assumed","."]
code: def paste(self, im, box=None):
      """
      Paste a PIL image into the bitmap image.
  
      :param im: A PIL image.  The size must match the target region.
                 If the mode does not match, the image is converted to the
                 mode of the bitmap image.
      :param box: A 4-tuple defining the left, upper, right, and
                  lower pixel coordinate.  See :ref:`coordinate-system`. If
                  None is given instead of a tuple, all of the image is
                  assumed.
      """
      im.load()
      if self.mode != im.mode:
          im = im.convert(self.mode)
      if box:
          self.image.paste(im.im, box)
      else:
          self.image.paste(im.im)
  
imports: from __future__ import annotations
  from .None import Image
label_desc: Use image node_id 5 for calling the Dib obj's underlying member method code with example usage: obj.paste(im, box) without return types