ImageDraw

Text Nairobi and a rectangle.

ImageDraw.Draw(im) paints rectangles and text onto the image.

Goal

Draw a labelled Nairobi bar.

from PIL import Image, ImageDraw
im = Image.new('RGB', (200, 80), (29, 79, 122))
d = ImageDraw.Draw(im)
d.rectangle((10, 10, 190, 70), outline=(255, 255, 255), width=2)
d.text((20, 30), 'Nairobi kiosk', fill=(255, 255, 255))
plt.imshow(im)
plt.axis('off')
plt.show()
print(im.size)
from PIL import Image, ImageDraw
im = Image.new('RGB', (60, 60), (0, 0, 0))
ImageDraw.Draw(im).ellipse((10, 10, 50, 50), fill=(0, 128, 64))
print(im.getpixel((30, 30)))
from PIL import Image, ImageDraw
im = Image.new('RGB', (40, 40), (255, 255, 255))
ImageDraw.Draw(im).line((0, 0, 39, 39), fill=(200, 40, 40), width=2)
print('ok')
from PIL import Image, ImageDraw
print(ImageDraw.Draw(Image.new('RGB', (4, 4))))