File size: 426 Bytes
81e69dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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) |