Image.new(mode, size, color) fills a rectangle. Kenya-ish flag blocks are teaching colors, not a legal flag.
Goal
Print three solid colors.
from PIL import Image
for color in ((0, 0, 0), (0, 128, 64), (255, 200, 0)):
im = Image.new('RGB', (40, 20), color)
print(color, im.getpixel((0, 0)))from PIL import Image
im = Image.new('RGB', (90, 30), (29, 79, 122))
plt.imshow(im)
plt.axis('off')
plt.show()
print(im.size)from PIL import Image
print(Image.new('RGBA', (8, 8), (255, 0, 0, 128)).mode)from PIL import Image
print(Image.new('RGB', (1, 1)).size)