Skinpy
A Python library for Minecraft skins.
- Load skins from a file, or start from scratch
- Index with 3D coordinates to get/set skin pixel color
- Operate at the skin level, the body part level, or even just one face
- Generate skin images for use in-game
- Render isometric ("angled/tilted view", like above) images of your skin
TODO: Add support for second layer
Installation
pip install skinpy
Quickstart
Creating/Loading/Saving a skin
from skinpy import Skin
# make a new skin
new_skin = Skin.new()
new_skin.to_image().save("blank.png")
# or load a skin from disk
loaded_skin = Skin.from_path("my_skin.png")
loaded_skin.to_image().save("copy.png")
Rendering Isometric Images
You can render isometric images with the CLI tool:
skinpy render steve.png -o render.png
# see help with `skinpy render --help`
Or, here'e the API interface:
from skinpy import Skin, Perspective
skin = Skin.from_path("steve.png")
# create a perspective from which to view the render
perspective = Perspective(
x="left",
y="front",
z="up",
scaling_factor=5, # bigger numbers mean bigger image
)
# save the render
skin.to_isometric_image(perspective).save("render.png")
Outputted file:
Pixel Indexing
from skinpy import Skin
skin = Skin.from_path("steve.png")
magenta = (211, 54, 130, 255) # RGBA
# get/set using entire skin's 3D coordinates
color = skin.get_color(4, 2, 0, "front") # somewhere on steve's right foot
print(f"Skin pixel at (4, 2, 0, 'front') was {color}")
skin.set_color(4, 2, 0, "front", magenta)
# get/set on just a head. coordinates become relative to just that part
color = skin.head.get_color(0, 1, 2, "left")
print(f"Head pixel at (0, 1, 2, 'left') was {color}")
skin.head.set_color(0, 1, 2, "left", magenta)
# or finally, just on one face. faces only have two dimensions
# NOTE: Face does not necessarily mean just a character's face! It just
# refers to the side of a cubiod, which all body parts are in Minecraft
color = skin.left_arm.up.get_color(5, 5)
print(f"Left arm up pixel at (5, 5) was {color}")
skin.head.set_color(0, 1, 2, "left", magenta)
skin.to_image().save("some_magenta.png")
Here's an animated visualization of equivalent ways to access a certain pixel:
(This image was made with examples/index.py.)
Pixel Enumeration
from skinpy import Skin
skin = Skin.from_path("steve.png")
for (x, y, z), body_part_id, face_id, color in skin.enumerate_color():
print(f"{x=}, {y=}, {z=}, {body_part_id=}, {face_id=}, {color=}")
for (x, y, z), face_id, color in skin.torso.enumerate_color():
print(f"{x=}, {y=}, {z=}, {face_id=}, {color=}")
for (x, y), face_id, color in skin.torso.back.enumerate_color():
print(f"{x=}, {y=}, {color=}")
Coordinate system
Skinpy uses a coordinate system with the origin at the left-down-front of the skin from the perspective of an observer looking at the skin.
FaceId
In some methods, a FaceId type is asked for or provided. These are string literals:
updownleftrightfrontback
BodyPartId
Similarly, body parts are string literals under BodyPartId:
headtorsoright_armleft_armright_legleft_leg
Body parts that are "left" or "right" follow the same perspective as before: from the observer's point of view.
Examples
You can find the skins/renders, and the code to produced them, in examples.
Metadata
Release files for skinpy 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| skinpy-0.0.4.tar.gz | 236.4 kB | Without provenance | Details for skinpy-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| skinpy-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for skinpy-0.0.4-py3-none-any.whl |
Total release size: 247.4 kB
Release files / skinpy-0.0.4.tar.gz
| Download URL | skinpy-0.0.4.tar.gz |
|---|---|
| Size | 236.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9bf65567dc7dc9d853fa80387ea47395e5b9b84caef14cd901d127d42308248f
|
|
BLAKE2b-256 checksum How to use checksums |
4f8fa1f62d01b30c526fb1f1e814b5138b1e8b93f08de3d08ad55758a4411952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.17.1 CPython/3.12.0 Windows/11
|
Release files / skinpy-0.0.4-py3-none-any.whl
| Download URL | skinpy-0.0.4-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7edd5c68dc6de9696562b619aaa9a2b405ebbd3f8aae86bb218e1e34c864330b
|
|
BLAKE2b-256 checksum How to use checksums |
dedfb60c920ecbb9df1e5a473db830f01ac90e152657b9a0ae35c67975b5b7c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.17.1 CPython/3.12.0 Windows/11
|
Security for skinpy 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.