Skip to main content

Unique avatars from dozens of styles — deterministic, customizable, vector-based.

Project description

DiceBear Core (Python)

Python implementation of the DiceBear avatar library. Generates deterministic SVG avatars from style definitions and a seed string.

DiceBear is available for multiple languages. All implementations share the same PRNG and rendering pipeline, producing identical SVG output for the same seed, style, and options, regardless of the language used.

Playground | Documentation

Installation

pip install dicebear-core

Requires Python 3.10 or newer.

Usage

import json
from importlib.resources import files

from dicebear import Avatar

# From a style definition (here from the dicebear-styles package)
definition = json.loads(
    files("dicebear_styles").joinpath("lorelei.json").read_text("utf-8")
)

avatar = Avatar(definition, {"seed": "John Doe", "size": 128})

avatar.to_string()    # SVG string
avatar.to_data_uri()  # data:image/svg+xml;charset=utf-8,...

Using the Style class

from dicebear import Avatar, Style

style = Style(definition)

# Create multiple avatars from the same style
avatar1 = Avatar(style, {"seed": "Alice"})
avatar2 = Avatar(style, {"seed": "Bob"})

Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or discounted products.

bunny.net

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

dicebear_core-10.3.0.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dicebear_core-10.3.0-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file dicebear_core-10.3.0.tar.gz.

File metadata

  • Download URL: dicebear_core-10.3.0.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dicebear_core-10.3.0.tar.gz
Algorithm Hash digest
SHA256 8e8e51fc4051d15d62df8866508790f713cf42519d436b74cb13c0d520772f63
MD5 2c79413b6ce3f026758b26f0c28497fb
BLAKE2b-256 710ee31eec02f1a0eb38461ea55c8a0ef48aa2e063072e4c791b6812976b1759

See more details on using hashes here.

Provenance

The following attestation bundles were made for dicebear_core-10.3.0.tar.gz:

Publisher: publish.yml on dicebear/dicebear

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dicebear_core-10.3.0-py3-none-any.whl.

File metadata

  • Download URL: dicebear_core-10.3.0-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dicebear_core-10.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32746779504b24fa1c19580b4d3515c14303457deb8b5600b291456442f5ed85
MD5 f501017f3ca1a9b5cc4012d541ae5e89
BLAKE2b-256 245e8644b4adabee0072d2a554d36c53b9ade1933a9047bd6befb7675446e66b

See more details on using hashes here.

Provenance

The following attestation bundles were made for dicebear_core-10.3.0-py3-none-any.whl:

Publisher: publish.yml on dicebear/dicebear

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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