pillow-minecraft-map
A plugin for Pillow (PIL) that enables loading, viewing, saving, and manipulation of Minecraft .dat map item files.
Features
- Open Minecraft maps using standard Pillow syntax (
Image.open("map_0.dat")). - Exposes location details (
xCenter,zCenter,scale) to Pillow's.infoattribute.
Important Note on Compatibility
Only Minecraft Java Edition map files are supported at this time. Minecraft Bedrock Edition utilizes a different map info format.
Installation
Install the package via pip:
pip install pillow-minecraft-map
Usage
Import the module to register the .dat plugin handlers into Pillow's image loader database.
Reading Map Images
from PIL import Image
import pillow_minecraft_map # Activates the extension
# Open the map file
with Image.open("tests/data/map_130.dat") as img:
# Convert from 8-bit color-indexed format ("P") to True Color ("RGB")
rgb_img = img.convert("RGB")
# Open inside your system's default image viewer
rgb_img.show()
# Export it to a standard format
rgb_img.save("minecraft_map_render.png")
Accessing Map Metadata (info)
The plugin maps in-game positioning values into the image's .info dictionary:
from PIL import Image
import pillow_minecraft_map
with Image.open("tests/data/map_130.dat") as img:
x = img.info.get("x_center")
z = img.info.get("z_center")
scale_factor = img.info.get("scale")
version = img.info.get("data_version")
# Calculate real-world block coverage
block_width = 128 * (2 ** scale_factor)
print(f"Minecraft DataVersion: {version}")
print(f"Center Coordinates: X={x}, Z={z}")
print(f"Scale: 1:{2**scale_factor} ({block_width}x{block_width} blocks total)")
Saving map files
To see your image in-game, you must overwrite a map file previously created in-game.
from PIL import Image
import pillow_minecraft_map
with Image.open("hopper.jpg") as img:
img.save("map_0.dat", format="MINECRAFT_MAP", version="26.2")
License
This project is licensed under the MIT License - see the LICENSE file for 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
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 pillow_minecraft_map-1.1.2.tar.gz.
File metadata
- Download URL: pillow_minecraft_map-1.1.2.tar.gz
- Upload date:
- Size: 10.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddfbeabe495d43d78991fc1fce9a0164ba9ab557ca98cdec33b307e199f5f361
|
|
| MD5 |
4787c100413b896e7a5989c3afad9d75
|
|
| BLAKE2b-256 |
27396e8095a2fff971055e7c34471b398965c3c3dc03f336f4d0f1e10a1aea90
|
File details
Details for the file pillow_minecraft_map-1.1.2-py2.py3-none-any.whl.
File metadata
- Download URL: pillow_minecraft_map-1.1.2-py2.py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
177a05a7d04aecd48605aa127bef1a24f4b91499e70079728bc1274d44a7e992
|
|
| MD5 |
8f6d7ede56ec13b0fec5ae372f3ee658
|
|
| BLAKE2b-256 |
8ed416d9d6f8697c0c16b56cab6d5f5fa7bba9819dd21c1041ac0049d228d43c
|