Skip to main content

Multicultural Avatar Generator in Python

Project description

Multiavatar


Multiavatar is a multicultural avatar generator.

In total, it is possible to generate 12,230,590,464 cryptographically unique avatars.

Initially coded in JavaScript, this version of Multiavatar is re-created in Python.

For more details about the Multiavatar Generator, please refer to the readme available in the JS repository.

Installation

Install Multiavatar with pip:

pip install multiavatar

Import Multiavatar in your Python code:

from multiavatar.multiavatar import multiavatar

Usage

svgCode = multiavatar("Binx Bond", None, None);
print(svgCode)

For advanced usage, pass boolean True as the second parameter if you wish to generate an avatar without the environment part.

Pass a dictionary as the third parameter to generate a specific avatar version.

avatarId = "ANY_STRING"
svgCode = multiavatar(avatarId, True, { "part": "11", "theme": "C" })

Testing

To catch bugs, the representation of tests should be visual because not all bugs have programmatic errors. For example, if an equal length color array is mixed, or a double semicolon appears in a color string, in such cases an error is not thrown, but the visual representation of avatar(-s) becomes broken.

There are two types of tests, currently available in index.html and other.html files. Simply open these files in your browser. Build these files by running the Python build scripts in the test folder.

In the index.html file, visually presented are all 48 base versions or avatars. If all 48 base versions are good, then it means that all 12 billion are also good, because the 12 billion are constructed from different parts of the 48 base versions. All avatars in this file should look exactly the same as in the JavaScript repository's \svg\index.html file.

In the other.html file, additional various tests are performed to test different approaches how to generate avatars, specific avatar versions, or some repository-specific cases.

API

Alternatively to this Python script, you can use Multiavatar through the web API.

To get an avatar as SVG code, add the avatar's ID to the URL:

https://api.multiavatar.com/Binx Bond

JavaScript API call example to get SVG code:

let avatarId = 'Binx Bond'
fetch('https://api.multiavatar.com/'
+JSON.stringify(avatarId))
  .then(res => res.text())
  .then(svg => console.log(svg))

To get an avatar as SVG file, add .svg to the end of the URL:

https://api.multiavatar.com/Binx Bond.svg

To get an avatar as PNG file, add .png to the end of the URL:

https://api.multiavatar.com/Binx Bond.png

License

You can use Multiavatar for free, as long as the conditions described in the LICENSE are followed.

Screenshots


More info

For additional information and extended functionality, visit the multiavatar.com web-app.

The app is based on static html for the home page, and on Laravel 8 + Vue.js for extended functionality, including the web store.

The product mockup generator for the Merch Maker is based on the ImageMagick PHP library.

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

multiavatar-1.0.2.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

multiavatar-1.0.2-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

Details for the file multiavatar-1.0.2.tar.gz.

File metadata

  • Download URL: multiavatar-1.0.2.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.0

File hashes

Hashes for multiavatar-1.0.2.tar.gz
Algorithm Hash digest
SHA256 614a363b2fcdf1d504c418e7b838655d51b8709245357c7afd442a673bd71b19
MD5 2696c74219df5132681f473487f33eb7
BLAKE2b-256 38ee1ecfc2ea78f5e24bddfeea91a064b92a326766823098417d9c3f6972fb41

See more details on using hashes here.

File details

Details for the file multiavatar-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: multiavatar-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.9.0

File hashes

Hashes for multiavatar-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9b8263b78bc302c484ddf49bbf93f55aeb6cb4eda6e4f249b97432704c7959d4
MD5 2f6fa9ce735f0b99e256fa819f96c142
BLAKE2b-256 e051cfe841d029156a52131a64447bc31f84a3255df4177b30a6f96197ab8378

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