code: def drawmask(self, maskarray, colour = 128):
          
          self.checkforpilimage()
          self.changecolourmode(colour)
          self.makedraw()
          
          # Checking size of maskarray :
          if maskarray.shape[0] != self.pilimage.size[0] or maskarray.shape[1] != self.pilimage.size[1]:
              raise RuntimeError, "Mask and image must have the same size !"
          
          # We make an "L" mode image out of the mask :
          tmparray = np.zeros(maskarray.shape, dtype=np.uint8)
          tmparray[maskarray] = 255
          maskpil = imop.flip(im.fromarray(tmparray.transpose()))
          
          # We make a plain colour image :
          if type(colour) == type(0) :
              plainpil = im.new("L", self.pilimage.size, colour)
          else :
              plainpil = im.new("RGB", self.pilimage.size, colour)
              
          # We switch self to RGB if needed :
          self.changecolourmode(colour)
          
          # And now use the function composite to "blend" our image with the plain colour image :
          
          self.pilimage = im.composite(plainpil, self.pilimage, maskpil)
          
          # As we have changed the image object, we have to rebuild the draw object :
          self.draw = None
docs: I draw a mask on the image.
          Give me a numpy "maskarray" of same size as mine, and I draw on the pilimage all pixels
          of the maskarray that are True in the maskcolour.
          By default, colour is gray, to avoid switching to RGB.
          But if you give for instance (255, 0, 0), I will do the switch.