Oversimplified Github-like userpic (avatar) generator.
Get started by installing the library via pip:
pip install tiny-userpic
from PIL.Image import Image
from userpic import make_userpic_image
# Generate a PIL Image object
image: Image = make_userpic_image(
size=(7, 5),
padding=(20, 10),
mode='RGB',
image_size=(300, 300),
background='white',
foreground='black',
)
# save as JPEG file
with open('output.jpeg', 'wb') as fp:
image.save(fp)
from userpic import make_userpic_svg
# Generate SVG string data
image: str = make_userpic_svg(
size=(7, 5),
padding=(20, 10),
image_size=(300, 300),
background='white',
foreground='black',
)
# save as SVG file
with open('output.svg', 'w') as fp:
fp.write(image)
Check out the awesome userpic you can generate: