Skip to content

Oversimplified Github-like userpics generation python library

License

Notifications You must be signed in to change notification settings

shpaker/tiny-userpic

Repository files navigation

Github-like Userpic (Avatar) Generator

Oversimplified Github-like userpic (avatar) generator.

Ruff PyPI PyPI

Installation

Get started by installing the library via pip:

pip install tiny-userpic

Create a PIL Image

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)

Create SVG Data

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)

Example Output

Check out the awesome userpic you can generate:

Awesome generated userpic!

About

Oversimplified Github-like userpics generation python library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published