Avatar
Base class for the avatar generator.
Last updated
Was this helpful?
Base class for the avatar generator.
Last updated
Was this helpful?
style
(): the style of the avatar
seed
(): the seed of the avatar
options
(): the options of the avatar
customisations
(): the customisations of the avatar (alias: customs
)
url_svg
(): svg url for the avatar
url_webp
(): webp url for the avatar
url_avif
(): avif url for the avatar
url_png
(): png url for the avatar
url_jpg
(): jpg url for the avatar
url_jpeg
(): jpeg url for the avatar
url_json
(): json url for the avatar data
schema
(): the dict schema of the avatar style
Create an avatar using this class. str(DAvatar)
returns the svg url.
Returns:
None
: when called as string it will return the svg link
style
DStyle.random()
seed
None
Base string to determine the avatar.
options
DOptions.empty
General options for the avatar.
custom
None
Customisations (for the chosen style)
save_to_cache
True
Whether to cache the avatar (improved efficiency)
style
None
seed
None
Base string to determine the edited avatar.
extra_options
None
Edit the avatar's options (old options stay, these get added or overwrite if they already existed).
blank_options
None
Edit the avatar's options (all old options get deleted and these get added, replacing the old options).
Deprecated: removed since v2.2.3
Alias: customize()
extra_options
None
Edit the avatar's options (old options stay, these get added or overwrite if they already existed).
blank_options
None
Edit the avatar's options (all old options get deleted and these get added, replacing the old options).
Save the avatar to your device.
Raises:
location
current directory
Location to save the avatar file.
file_name
"dicebear_avatar"
Name to give the avatar file.
file_format
DFormat.svg
Which format to use.
overwrite
False
Whether to overwrite already existing images with the given filename.
open_after_save
False
Whether to open the image after saving.
Alias: open()
Returns:
None
format
DFormat.svg
What format to use when opening the avatar image.
use_pil
True
Whether to use PIL module or something else to open the avatar.
Returns the avatar's full text/file in str
format. (only useful for svg
and json
)
Returns:
str
: the text of the image
format
DFormat.svg
What format to use.
Returns the avatar's bytes in io.BytesIO
format (only useful for png
and jpg
).
Use io.BytesIO.read()
to convert it to actual bytes when necessary.
Returns:
io.BytesIO
: the bytes of the image
format
DFormat.png
What format to use.
The style of avatar you want to create ()
Edit an already existing .
Returns: : the svg link of the edited avatar
The new style of avatar you want to edit ()
-> use instead.
Customise the specific options for an already existing avatar. Specific options/customisations are different for every style, so make sure to check all the possibilities .
Returns: : the svg link of the edited avatar
Returns: : the path where the avatar has been saved if successful else -1
: Image has a ValueError
: Image cannot be written to your devide (OSError)
: Unknown Exception
|
Open and view a object.
Convert a instance to a object.
Returns: : the Image object to edit using the Pillow module
Raises: : if Pillow module is not found on your device