pip install pillow
python
from PIL import Image
im = Image.open('example.jpg')
print(im.format, im.size, im.mode)
im = im.resize((256, 256), Image.ANTIALIAS)
im = im.transpose(Image.FLIP_LEFT_RIGHT)
im = Image.new('RGBA', im.size, (255, 255, 255, 0))
draw = ImageDraw.Draw(im)
draw.text((10, 10), 'Hello', fill=(255, 0, 0, 255))
draw.rectangle((10, 40, 70, 60), fill=(0, 128, 0, 255))
im.save('example_result.jpg')