code: def export(self, filename):
      
          
  
          self.flatten()
          self.layers[1].img.save(filename)
          return filename
docs: Exports the flattened canvas.
      
          Flattens the canvas.
          PNG retains the alpha channel information.
          Other possibilities are JPEG and GIF.