Practice: kiosk poster

Title bar, three color panels, save.

Title bar plus three city color panels, save poster.png.

Goal

Print the size and a pixel from each panel.

from PIL import Image, ImageDraw, ImageFont
im = Image.new('RGB', (240, 120), (20, 20, 20))
d = ImageDraw.Draw(im)
d.rectangle((0, 0, 240, 28), fill=(29, 79, 122))
d.text((8, 8), 'Kenya kiosks', font=ImageFont.load_default(), fill=(255, 255, 255))
panels = [(0, 128, 64), (29, 79, 122), (200, 40, 40)]
for i, color in enumerate(panels):
    x0 = 10 + i * 76
    d.rectangle((x0, 40, x0 + 68, 108), fill=color)
im.save('poster.png')
plt.imshow(im)
plt.axis('off')
plt.show()
print(im.size)
print('left', im.getpixel((20, 70)), 'mid', im.getpixel((110, 70)), 'right', im.getpixel((200, 70)))