def im_watermark(im, inputtext, font=None, color=None, opacity=<NUM_LIT>, margin=(<NUM_LIT:30>, <NUM_LIT:30>)):
if im.mode != "<STR_LIT>":<EOL><INDENT>im = im.convert("<STR_LIT>")<EOL><DEDENT>textlayer = Image.new("<STR_LIT>", im.size, (<NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>))<EOL>textdraw = ImageDraw.Draw(textlayer)<EOL>textsize = textdraw.textsize(inputtext, font=font)<EOL>textpos = [im.size[i] - textsize[i] - margin[i] for i in [<NUM_LIT:0>, <NUM_LIT:1>]]<EOL>textdraw.text(textpos, inputtext, font=font, fill=color)<EOL>if opacity != <NUM_LIT:1>:<EOL><INDENT>textlayer = reduce_opacity(textlayer, opacity)<EOL><DEDENT>return Image.composite(textlayer, im, textlayer)<EOL>
imprints a PIL image with the indicated text in lower-right corner