code: def export_image(self, bbox, zoomlevel, imagepath):
          
          assert has_pil, _("Cannot export image without python PIL")
          grid = self.grid_tiles(bbox, zoomlevel)
          width = len(grid[0])
          height = len(grid)
          widthpix = width * self.tile_size
          heightpix = height * self.tile_size
  
          result = Image.new("RGBA", (widthpix, heightpix))
          offset = (0, 0)
          for i, row in enumerate(grid):
              for j, (x, y) in enumerate(row):
                  offset = (j * self.tile_size, i * self.tile_size)
                  img = self._tile_image(self.tile((zoomlevel, x, y)))
                  result.paste(img, offset)
          logger.info(_("Save resulting image to '%s'") % imagepath)
          result.save(imagepath)
docs: Writes to ``imagepath`` the tiles for the specified bounding box and zoomlevel.