#!/bin/env python3 from PIL import Image, ImageDraw, ImageFont import sys import os print(sys.argv) img_path=sys.argv[1] text=sys.argv[2] size=int(sys.argv[3]) loc_x=int(sys.argv[4]) loc_y=int(sys.argv[5]) color_text=sys.argv[6] output=sys.argv[7] # create Image object with the input image image = Image.open(img_path) # initiate the drawing context with # the image object as background draw = ImageDraw.Draw(image) # create font object with the font file and specify # desired size ttf=os.path.dirname(sys.argv[0])+'/arial.ttf' print(ttf) font = ImageFont.truetype(ttf, size=size) (x, y)=(loc_x, loc_y) message = text color = color_text # draw the message on the background draw.text((x, y), message, fill=color, font=font) # save the edited image image.save(output)