shpaker/tiny-userpic: An oversimplified GitHub-like userpic generation Python library in a single small file

Klenance
1 Min Read

Oversimplified Github-like userpic (avatar) generator.


PyPI
PyPI

Get started by installing the library via pip:

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:

Awesome generated userpic!

Source link

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *