Skip to main content

Random avatars generator

Project description

AvatarGenerator

A simple avatar generator with the ability to export to PNG and SVG.

The whole system is built on SVG.

The idea and all the parts were taken from getavataaars.com

For use you need install ImageMagick

Developed by y0gurt-dv 2022.

Parts

Lists of all the preset parts you can import from the library.

You can specify your own colors in the color fields, but if the color is not specified, it will be selected from the preset ones.

from AvatarsGenerator import (

    HAIR_COLORS,

    PALETTE_COLORS,

    SKIN_COLORS,

    MOUTHS_NAMES,

    EYEBROWS_NAMES,

    EYES_NAMES,

    HATS_NAMES,

    FACIALHAIRS_NAMES,

    GLASSES_NAMES,

    ACCESORIES_NAMES,

    HAIRS_NAMES,

    CLOTHING_NAMES,

    GRAPHICS_NAMES,

)

Examples of How To Use

from AvatarsGenerator import generate_avatar



# Example of config 

config = {

    'eyebrow_name': '',

    'eyes_name': '',

    'mouth_name': '',

    'skin_color': '',

    "clothing_name": '',

    "clothing_color": '',

    'graphic_name': '',

    'hat_name': '',

    'hat_color': '',

    'hair_name': '',

    'hair_color': '',

    'facial_hair_name': '',

    'facial_hair_color': '',

    'glasses_name': '', 

    'accesories_name': '',

}

png_bytes = generate_avatar(

    config=config, 

    output_type='png_bytes', 

    #Optional parameter. Default True

    auto_optional=True

)

with open('avatar.png', 'wb') as fp:

    fp.write(png_bytes)

if auto_optional == True

  • All optional field will be filled in automatically

  • All required fields (fields that are not in OPTIONAL_FIELDS)  that are not specified in the config

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

AvatarsGenerator-0.0.4.tar.gz (103.7 kB view details)

Uploaded Source

Built Distribution

AvatarsGenerator-0.0.4-py3-none-any.whl (144.2 kB view details)

Uploaded Python 3

File details

Details for the file AvatarsGenerator-0.0.4.tar.gz.

File metadata

  • Download URL: AvatarsGenerator-0.0.4.tar.gz
  • Upload date:
  • Size: 103.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for AvatarsGenerator-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c92b9ad6f5d28dfb37b5a55e81403673c24a06fd78ac351294c2982ca4ecc9df
MD5 baf95916ce08147b684d48b5af43444e
BLAKE2b-256 3aac4a1d4da8f7c3e4af6320796482a760741018158fe9bea2c8076d0b3839ed

See more details on using hashes here.

File details

Details for the file AvatarsGenerator-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for AvatarsGenerator-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad0981bead6c2256692e86dea7b3d615bf6d32aa915bcd4e834f5d5a91e5dfc
MD5 f4722d7a3fe7c27318d25a95a30fa3af
BLAKE2b-256 35adb78cb9d8cf331b943327603ae0fef78cd53e3583a672a41b49d85fad1628

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page