在图像上绘制文本

时间:2015-03-25 13:52:07

标签: python image-processing pillow

我正在尝试在QR码的图像上写文字,但它失败并显示以下消息:

在我看来,我有:

Font = ImageFont.truetype("/usr/share/fonts/truetype/ttf-lyx/cmmi10.ttf",14)

imageFile = "Qrcode.png"

in1=Image.open(imageFi1e)

# Convert to RGB mode
if im1.mode != "RGB":
    im1.convert("RGB")

# Drawing the text on the picture
draw = ImageDraw.Draw(im1)
draw.text((0, 0),"Marwa",(55,55,0),font=font)
draw = ImageDraw.Draw(im1)

# Save the image with a new name
im1.save("marked_image.png")

0 个答案:

没有答案