今天在刷微博的时候看到一组暗藏"我喜欢你"的图片
突然想了解是怎么样实现的
参考博客:https://blog.youkuaiyun.com/kangqiao0422/article/details/104310848?utm_source=app
原图
效果图
是不是看不清楚,我们放大来看看
代码实现
需要用到的是PIL库,安装(pip install Pillow)
PIL文档请戳下面链接
https://pillow.readthedocs.io/en/stable/handbook/tutorial.html#using-the-image-class
全部代码:
from PIL import Image, ImageDraw, ImageFont, ImageMode
#设置字体打印大小
font_size &