|
@@ -3,7 +3,9 @@ from PIL import Image,ImageDraw,ImageFont
|
|
|
unicode_text = "這是一段中文測試"
|
|
|
#font = ImageFont.truetype("c:/portable/fonts/華康綜藝體.ttf", 40,encoding='big5')
|
|
|
#font = ImageFont.truetype("c:/portable/fonts/華康綜藝體.ttf", 40,encoding='big5')
|
|
|
-font = ImageFont.truetype("/var/fonts/adv.ttf", 40,encoding='big5')
|
|
|
+
|
|
|
+font = ImageFont.truetype("c:/portable/fonts/adv.ttf", 40,encoding='big5')
|
|
|
+#font = ImageFont.truetype("/var/fonts/adv.ttf", 40,encoding='big5')
|
|
|
|
|
|
text_width, text_height = font.getsize(unicode_text)
|
|
|
|
|
@@ -23,8 +25,8 @@ text=''
|
|
|
for c in unicode_text:
|
|
|
text+=myunichchar(c)
|
|
|
#text=myunichchar('中')+myunichchar('文')+myunichchar('測')+myunichchar('試')
|
|
|
-draw.text((5,5), text, (255, 0, 0), font)
|
|
|
+draw.text((5,5), text, (255, 255, 255), font)
|
|
|
|
|
|
# save the blank canvas to a file
|
|
|
-canvas.save("unicode-text.png", "PNG")
|
|
|
+canvas.save("/var/txt/title.png", "PNG")
|
|
|
canvas.show()
|