Skip to main content

A library for generating the texture of Minecraft's Totem of Undying

Project description

TotemLib

aka wavy-totem-lib

PyPI - Python Version GitHub License GitHub repo size

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 of resize() 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 Abstract class and implementing the image method.

Wavy

This is the default pattern in TotemBuilder.

Notch (wide) WavyCat (slim) CyCeKu (wide)
Skin Skin Skin
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)
Skin Skin Skin
from wavy_totem_lib import TotemBuilder
from wavy_totem_lib.patterns import STT

TotemBuilder(pattern=STT)

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

wavy_totem_lib-2.1.2.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

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

wavy_totem_lib-2.1.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file wavy_totem_lib-2.1.2.tar.gz.

File metadata

  • Download URL: wavy_totem_lib-2.1.2.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

Hashes for wavy_totem_lib-2.1.2.tar.gz
Algorithm Hash digest
SHA256 030f65e17cd28789a898a0536d68e90138c0efbb84349724b875478233987ea5
MD5 f7cd8b29b0add6a5841eae693225a824
BLAKE2b-256 f6558575827aa7ef724188cfdcb76659b5ab15d8486a4a86ce2a19f69f6f5d0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for wavy_totem_lib-2.1.2.tar.gz:

Publisher: publish.yml on wavy-cat/wavy-totem-lib

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

File details

Details for the file wavy_totem_lib-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: wavy_totem_lib-2.1.2-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

Hashes for wavy_totem_lib-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 683a8a4dd825d0bb07cf1631c52b84d1f412c7afad1072777c33ec5431fb2af0
MD5 8a5ee4240bf080c8e904e457eb03e983
BLAKE2b-256 8b7dbd062c0aaf1baa6363b525ba4847116aefc062119fcf65bd7595831d7977

See more details on using hashes here.

Provenance

The following attestation bundles were made for wavy_totem_lib-2.1.2-py3-none-any.whl:

Publisher: publish.yml on wavy-cat/wavy-totem-lib

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