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 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 style
from wavy_totem_lib import TotemBuilder, Skin, Totem, STTStyle
# WavyStyle (default), STTStyle available built-in
builder = TotemBuilder(Skin('my_skin.png'), style=STTStyle)
totem: Totem = builder.build()
totem.image.save('totem.png')
The
generate()
method accepts **kwargs, which will be passed on to the style class. None of the built-in styles support them.
Styles
[!NOTE] You can create your own styles by inheriting the
AbstractStyle
class and implementing theimage
property.
Wavy
Class name: WavyStyle
.
This is the default style in TotemBuilder.
Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
---|---|---|
from wavy_totem_lib import TotemBuilder, WavyStyle
TotemBuilder(style=WavyStyle)
# You can also not specify style at all, because WavyStyle – default style.
STT
Class name: STTStyle
.
The code is taken from the UnFamousSoul/STT repository.
Notch (wide) | WavyCat (slim) | CyCeKu (wide) |
---|---|---|
from wavy_totem_lib import TotemBuilder, STTStyle
TotemBuilder(style=STTStyle)
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
Built Distribution
File details
Details for the file wavy_totem_lib-2.0.1.tar.gz
.
File metadata
- Download URL: wavy_totem_lib-2.0.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
96df4b9f55322d90f20e1337b02530e25ea55f318d2abc4568403e9e4db9ae6e
|
|
MD5 |
4be0121f0c2970ce7f62bd468d9ee6f3
|
|
BLAKE2b-256 |
6987d3a15e9afafc6ce01bc1404df7a5acaa71e962f1257f02fa4eeca44fdee2
|
Provenance
The following attestation bundles were made for wavy_totem_lib-2.0.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.0.1.tar.gz
-
Subject digest:
96df4b9f55322d90f20e1337b02530e25ea55f318d2abc4568403e9e4db9ae6e
- Sigstore transparency entry: 218163125
- Sigstore integration time:
-
Permalink:
wavy-cat/wavy-totem-lib@1b1e99b467819b860f35e134771c61cfdfef79b5
-
Branch / Tag:
- Owner: https://github.com/wavy-cat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@1b1e99b467819b860f35e134771c61cfdfef79b5
-
Trigger Event:
release
-
Statement type:
File details
Details for the file wavy_totem_lib-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: wavy_totem_lib-2.0.1-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b941047c30f4c1931173ba8a25a46e4bdd5cf6df99e78a230265f15ea565aa1c
|
|
MD5 |
b85ab830c275b3c7f9be1c3d060d3205
|
|
BLAKE2b-256 |
be38cee017c685ed5936b8bc0fe2214201ac1b4443a8840c2b2bac890433f4db
|
Provenance
The following attestation bundles were made for wavy_totem_lib-2.0.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.0.1-py3-none-any.whl
-
Subject digest:
b941047c30f4c1931173ba8a25a46e4bdd5cf6df99e78a230265f15ea565aa1c
- Sigstore transparency entry: 218163131
- Sigstore integration time:
-
Permalink:
wavy-cat/wavy-totem-lib@1b1e99b467819b860f35e134771c61cfdfef79b5
-
Branch / Tag:
- Owner: https://github.com/wavy-cat
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@1b1e99b467819b860f35e134771c61cfdfef79b5
-
Trigger Event:
release
-
Statement type: