comforticons
v0.1.0 is out
该软件包是针对不同标识/图标/gravatar/Avatar风味的一个标识子生成模块。
请参阅Libravatar项目和Gravatar项目。
该模块受Bitverseio的PHP标识子发生器架构/发电机和Azaghal的Pydenticon软件包(Gravatar Retro Like Sidenticon Generator)的启发。
链接到源。
该模块可在pypi.org上找到。
pip install comforticons
preprocessors列表和generator类电源的生成
python3 -m comforticons
from comforticons import Identicon
# Customize preprocessors and generator settings here
generator = Identicon ()
# This will generate 120x120 with 0 padding PNG identicon
# with transparent background 5x5 pixel identicon (retro gravatar)
# using PixelGenerator and MD5Preprocessor as default
identicon = generator . generate ( "provide data here" )
# Save to file
with open ( "image.png" , "wb" ) as file :
file . write ( identicon ) from comforticons import Identicon
from comforticons . preprocessors . hash import * # *Preprocessor
from comforticons . generators . image import * # PixelGenerator
# Customize preprocessors and generator settings here
generator = Identicon (
# First, process data with md5, then with sha1
preprocessors = [ MD5Preprocessor (), SHA1Preprocessor ],
generator = PixelGenerator (
size = 10 , # 10x10 grid
foreground_colors = [ "#ffffff" ], # Only use white foreground
background = "#000000" , # black, non-transparent background
image_format = "png" , # PNG image format
invert = True , # This will swap bg-fg colors
)
)
# Actually generate identicon
identicon = generator . generate ( "provide data here" )
# Save to file
with open ( "image.png" , "wb" ) as file :
file . write ( identicon )
MD5Preprocessor+PixelGenerator
“饰面”
SHA1Preprocessor+PixelGenerator
“饰面”
请参阅许可证。
另请参阅此许可证。