使用枕头创建社交网络片段的简单图像包。可以插入片段的图片,以便在社交网络中共享页面,例如在标签Meta:
snippet-image的Python项目详细描述
用于使用pillow为社交网络简单创建片段图像的包。
可插入片段图片以在社交网络中共享页面,例如在标记meta:
<metaproperty="og:image"content="Link to your snippet image"/><metaname="twitter:image"content="Link to your snippet image"/>
安装
pip3安装代码段映像
用户指南
要开始为片段创建图像,只需导入函数`from snippet_image import create_snippet_image`。
fromsnippet_imageimportcreate_snippet_imageimage_blob=create_snippet_image(font='/home/iamterminator/.fonts/OpenSans-Bold.ttf',# Path to your font filefont_size=62,# Font sizebackground='/home/iamterminator/.wallpapers/jakethedog.jpg',# Path to your background imagesize=(1200,630),# Size of snippet image. (width, height)text='Jake the Dog',# Text for draw on snippet imagebrightness=0.3,# Brightness of background)withopen('jake-the-dog-snippet-image.jpg','wb')asfile:file.write(image_blob.getvalue())