from PIL import Image,ImageDraw def create_color_image(width, height, color=(255,255,255)): img = Image.new('RGB', (width, height), color) return img def fill_points(image,points,color=(255,255,255)): draw = ImageDraw.Draw(image) int_points = [(int(x), int(y)) for x, y in points] draw.polygon(int_points, fill=color) return image def from_numpy(numpy_array): return Image.fromarray(numpy_array)