python将文字转换成图片
时间:2014-05-10 04:25:52
收藏:0
阅读:620
现在又很多工具能将文字转换成图片,这样就可以发送长微博,其实python实现这很容易的,主要就是用到了pygame模块
import os import pygame from pygame.locals import * pygame.init() text = u"这是一段测试文本,test 123。" font = pygame.font.SysFont(‘SimHei‘, 14) ftext = font.render(text, True, (0, 0, 0), (255, 255, 255)) pygame.image.save(ftext, "t.jpg")
评论(0)