I am trying to write some text over a grayscale png using PIL and following this thread. It seems pretty straightforward but I am not sure what I am doing wrong.
Yet, when I try to do it dies on the draw.text
function:
from PIL import Image, ImageDraw, ImageFont
img = Image.open("test.png")
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("open-sans/OpenSans-Regular.ttf", 8)
# crashes on the line below:
draw.text((0, 0), "Sample Text", (255, 255, 255), font=font)
img.save('test_out.png')
This is the error log:
"C:\Python27\lib\site-packages\PIL\ImageDraw.py", line 109, in _getink
ink = self.draw.draw_ink(ink, self.mode)
TypeError: function takes exactly 1 argument (3 given)
Can anyone point me out the issue?