Skip to main content

pillow-minecraft-map

A plugin for the Python Imaging Library Pillow (PIL) that enables loading, viewing, saving, and manipulation of Minecraft .dat map item files.

hopper map in minecraft

Features

  • Open Minecraft maps using standard Pillow syntax (Image.open("map_0.dat")).
  • Exposes location details (xCenter, zCenter, scale) to Pillow's .info attribute.

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. If you are targetting versions of Minecraft older than version 1.17, it's very important that you specify the target minecraft version in your save() command.

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

pillow_minecraft_map-1.1.3.tar.gz (10.6 MB view details)

Uploaded Source

Built Distribution

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

pillow_minecraft_map-1.1.3-py2.py3-none-any.whl (10.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pillow_minecraft_map-1.1.3.tar.gz.

File metadata

  • Download URL: pillow_minecraft_map-1.1.3.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

Hashes for pillow_minecraft_map-1.1.3.tar.gz
Algorithm Hash digest
SHA256 fbec65f9edbed1a834e51dffaecf97d239f69788f7f2ab2bf7dc5a30c30cb3de
MD5 7953287abcac8a1ddbd8437c21a65f1e
BLAKE2b-256 17359753ac5358fae18adfb706f40a441c54d65850f59e12b46648a441aa5877

See more details on using hashes here.

File details

Details for the file pillow_minecraft_map-1.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pillow_minecraft_map-1.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9a38877bad33e9363ae4c68643f8c0242a1117f6f6efd289dfbacf8000b81813
MD5 7402f22c0081e42e3a11c0f7a444996b
BLAKE2b-256 67b28034c9b42cef35004a0977aa1fbd8427ebf708b407282539bee28c68ab94

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.6

2 files

1.1.5

2 files

1.1.4

2 files

This release

1.1.3 This release

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page