A library for generating the texture of Minecraft's Totem of Undying
Project description
TotemLib
aka 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
- Supports PyPy
- Supports different patterns (styles)
Installing
Using uv
uv add wavy-totem-lib
Using Poetry
poetry add wavy-totem-lib
Using pip
pip install wavy-totem-lib
Quick start
from wavy_totem_lib import TotemBuilder, Skin, Totem, TopLayer
builder = TotemBuilder(
Skin('my_skin.png'),
top_layers=[TopLayer.HEAD], # the second layer will be applied only to the head
round_head=True # the head will be rounded at the corners
)
totem: Totem = builder.build()
totem.image.save('totem.png') # .image is Pillow image
More examples
Generation and scaling
from wavy_totem_lib import TotemBuilder, Skin, Totem
builder = TotemBuilder(Skin('my_skin.png', slim=True))
totem: Totem = builder.build()
scaled = totem.scale(factor=8) # Scaling from 16×16 to 128×128
scaled.save('totem.png')
To scale up, use the built-in
scale()method instead ofresize()from Pillow, because it may blur the image.
Asynchronous generation
import asyncio
from io import BytesIO
from wavy_totem_lib import TotemBuilder, Skin, Totem, TopLayer
# To save a file asynchronously, install the aiofiles package
import aiofiles
async def main():
builder = TotemBuilder(Skin('my_skin.png', slim=False),
top_layers=[TopLayer.HEAD, TopLayer.HANDS],
round_head=True)
totem: Totem = await builder.build_async()
temp = BytesIO()
totem.image.save(temp, format='png')
async with aiofiles.open('totem.png', 'wb') as f:
await f.write(temp.getvalue())
asyncio.run(main())
Specifying a pattern
from wavy_totem_lib import TotemBuilder, Skin, Totem
from wavy_totem_lib.patterns import STT
# Wavy is default, STT available built-in
builder = TotemBuilder(Skin('my_skin.png'), pattern=STT)
totem: Totem = builder.build()
totem.image.save('totem.png')
The
generate()method accepts **kwargs, which will be passed on to the pattern class. None of the built-in patterns support them.
Patterns
[!NOTE] You can create your own pattern by creating subclass from
Abstractclass and implementing theimagemethod.
Wavy
This is the default pattern in TotemBuilder.
| Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
|---|---|---|
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import Wavy
TotemBuilder(pattern=Wavy)
# You can also not specify the pattern at all, because WavyStyle – default pattern.
STT
The code is taken from the UnFamousSoul/STT repository.
| Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
|---|---|---|
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import STT
TotemBuilder(pattern=STT)
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-2.1.1.tar.gz.
File metadata
- Download URL: wavy_totem_lib-2.1.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
973f31fbf28e94106cb26573dc4724274199a4c3e3ff523e54c5f3461fde46c6
|
|
| MD5 |
3be8bc1f1490e5756a10a04d0ae8cffb
|
|
| BLAKE2b-256 |
eb36b95a1981f850efc78c70e4b5880a86296f5d7ecd3f529d838a0b567f1c34
|
Provenance
The following attestation bundles were made for wavy_totem_lib-2.1.1.tar.gz:
Publisher:
publish.yml on wavy-cat/wavy-totem-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wavy_totem_lib-2.1.1.tar.gz -
Subject digest:
973f31fbf28e94106cb26573dc4724274199a4c3e3ff523e54c5f3461fde46c6 - Sigstore transparency entry: 583882927
- Sigstore integration time:
-
Permalink:
wavy-cat/wavy-totem-lib@10c19aa971791ae5df64b9f4480b453e11f22682 -
Branch / Tag:
refs/tags/2.1.1 - Owner: https://github.com/wavy-cat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10c19aa971791ae5df64b9f4480b453e11f22682 -
Trigger Event:
release
-
Statement type:
File details
Details for the file wavy_totem_lib-2.1.1-py3-none-any.whl.
File metadata
- Download URL: wavy_totem_lib-2.1.1-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dac3944b240fbc7b284fc2ecc8d65bae39155a154b84d85ebf2b3bafd9863985
|
|
| MD5 |
27ff037effd29a899d2e738b88a231a4
|
|
| BLAKE2b-256 |
fc043e5e9e085a1c08406658ca51297106ba1794ab077793d6e1a64e0ad90fd4
|
Provenance
The following attestation bundles were made for wavy_totem_lib-2.1.1-py3-none-any.whl:
Publisher:
publish.yml on wavy-cat/wavy-totem-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
wavy_totem_lib-2.1.1-py3-none-any.whl -
Subject digest:
dac3944b240fbc7b284fc2ecc8d65bae39155a154b84d85ebf2b3bafd9863985 - Sigstore transparency entry: 583882928
- Sigstore integration time:
-
Permalink:
wavy-cat/wavy-totem-lib@10c19aa971791ae5df64b9f4480b453e11f22682 -
Branch / Tag:
refs/tags/2.1.1 - Owner: https://github.com/wavy-cat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10c19aa971791ae5df64b9f4480b453e11f22682 -
Trigger Event:
release
-
Statement type: