Python library to generate totems of undying for Minecraft
Project description
wavy-totem-lib
Python library to generate totems of undying for Minecraft.
Features
- Support 64x32 skins
- Zoning 2 layers and rounding the head
- Lossless scaling image size
- Asynchrony support
- Built-in CLI
- Supports PyPy
Requirements
- python >= 3.8
- Pillow >= 10.0.0
Installing
- Using poetry:
poetry add wavy-totem-lib - Using pip:
pip install wavy-totem-lib
You can also clone the repository or download
and extract the files from the project's ZIP archive into a folder and install the library in your
environment (pip install /path/to/lib/folder, poetry add /path/to/lib/folder).
Using CLI
You can use the library without writing code, from the terminal.
For help, enter the argument --help or -h (python3 cli.py --help).
usage: cli.py [-h] [--skin-type [{wide,slim,auto}]]
[--top-layers [{nothing,all,only_head,only_torso,only_hands,head_and_torso,head_and_hands}]]
[--round-head [ROUND_HEAD]] [--scale [FACTOR]]
skin_path totem_path
To give an example, the following command opens the skin file my_skin.png and creates a totem by rounding its head and saves it to the file totem.png at 64×64 resolution (4x scaling):
python3 cli.py my_skin.png totem.png --round-head true --scale 4
Parameters
| Name | Required? | Valid values | Default | Description |
|---|---|---|---|---|
| skin_path | ✔ | string | Path to the skin file | |
| totem_path | ✔ | string | Path where to save the finished totem file | |
| --skin-type | ✖ | string (wide, slim, auto) | auto | Indication of what type of skin is used |
| --top-layers | ✖ | string (see Enum values in CLI) | all | Indication of zoning 2 layers |
| --round-head | ✖ | bool | false | Should the head be rounded |
| --scale | ✖ | integer (>0) | 1 | Image scaling multiplier |
Examples
- Quick generation:
from wavy_totem_lib import TotemBuilder, SkinType, TopLayers
totem = TotemBuilder('my_skin.png', SkinType.AUTO, top_layers=TopLayers.ONLY_HEAD, round_head=True)
totem_image = totem.generate()
totem_image.save('totem.png')
- Generation and scaling:
from wavy_totem_lib import TotemBuilder, SkinType
totem = TotemBuilder('my_skin.png', SkinType.WIDE)
totem.generate()
totem.scale(factor=8) # Scaling from 16×16 to 128×128
totem.raw.show() # PIL.Image is available in the `raw` variable
[!NOTE] To scale up, use the built-in
scalemethod instead ofraw.resizefrom Pillow, because it may blur the image.
- Asynchronous generation:
import asyncio
from wavy_totem_lib import AsyncTotemBuilder, SkinType, TopLayers
async def main():
# Using AsyncTotemBuilder class instead of TotemBuilder
totem = AsyncTotemBuilder('my_skin.png', SkinType.SLIM, TopLayers.HEAD_AND_HANDS)
await totem.generate()
await totem.scale(factor=4) # 64×64
await totem.save('totem.png') # save() is only available in AsyncTotemBuilder
asyncio.run(main())
[!NOTE] Although
generate(),scale()andraware of typePIL.Image.Image, suitable for saving a file, it is better to use the built-in asynchronoussavemethod instead.
Enum values
SkinType: WIDE, SLIM, AUTO
TopLayers: NOTHING, ALL, ONLY_HEAD, ONLY_TORSO, ONLY_HANDS, HEAD_AND_TORSO, HEAD_AND_HANDS
In CLI
skin-type: wide, slim, auto
top-layers: nothing, all, only_head, only_torso, only_hands, head_and_torso, head_and_hands
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wavy_totem_lib-1.3.0.tar.gz.
File metadata
- Download URL: wavy_totem_lib-1.3.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-21-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac70872c2280640df717e9daca44c3ea8db976258f6b97aa8f5ff30e1bd1c7b2
|
|
| MD5 |
adbf7a74974a459bdd58612170c80d8e
|
|
| BLAKE2b-256 |
d390e0b6e12e57cc1b3a827fd0f4b5edd95df8e4adad78441119fdcef71106be
|
File details
Details for the file wavy_totem_lib-1.3.0-py3-none-any.whl.
File metadata
- Download URL: wavy_totem_lib-1.3.0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-21-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6f7f53e44d1ef71ae1556c2aa3e42f7b874b7428f8ef7e8de6a935f475399e1
|
|
| MD5 |
62bbf9b9a5d5ee411aace49ed201e8dd
|
|
| BLAKE2b-256 |
b86e334bb2f3117eb9636005078526d97bce6e9ac68aa34080b8e140160a63f3
|