
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
A zero dependency, lightweight and fast library to manipulate RPG images written in Rust.
.. image:: https://img.shields.io/pypi/v/rpg_map.svg :target: https://pypi.org/project/rpg_map/ :alt: PyPI version
.. image:: https://readthedocs.org/projects/rpg-map/badge/?version=latest :target: https://rpg-map.readthedocs.io/en/latest/ :alt: Documentation Status
A fast, zero-dependency Python library for visualizing exploration and movement across large pixel-based maps. Built in Rust for speed and efficiency, rpg_map
is perfect for turn-based or real-time RPGs, strategy games, and D&D-style map reveals.
Install via pip:
.. code:: bash
pip install rpg-map
Full documentation and examples available at: https://rpg-map.readthedocs.io/
The library uses step-by-step image processing to reveal and annotate the map. Here's an overview of the process:
Code:
This is the code which was used to generate the final result of the example steps below:
.. code:: python
from rpg_map import Travel, Map, MapType, PathStyle, PathProgressDisplayType, PathDisplayType from PIL import Image
LOCAL_DIR = "../test_assets/map.png" BACKGROUND_DIR = "../test_assets/background.png" GRID_SIZE = 20 START, END = (198, 390), (172, 223) START_X, START_Y = START
image = Image.open(LOCAL_DIR).convert("RGBA")
image_bytes = list(image.tobytes()) background = Image.open(BACKGROUND_DIR).convert("RGBA")
background_bytes = list(background.tobytes()) map = Map( image_bytes, image.size[0], image.size[1], GRID_SIZE, MapType.Limited, obstacles=[[(160, 240), (134, 253), (234, 257), (208, 239)]], )
travel = Travel(map, START, END) path_bits = Map.draw_background( map.with_dot(START_X, START_Y, (255, 0, 0, 255), 4).draw_path( travel, 1.0, 2, PathStyle.DottedWithOutline((255, 0, 0, 255), (255, 255, 255, 255)), ), background_bytes )
image = Image.frombytes("RGBA", (image.width, image.height), path_bits) image.show()
Steps:
Draw Obstacles
The Map
class accepts an obstacles
parameter which allows you to define N-sided polygons. These are rendered onto the map as solid barriers.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/1.png?raw=true :width: 600
Add Padding and Convert to Pathfinding Grid
Obstacles and map edges are padded and the image is converted into a binary map (0 = path, 1 = obstacle) for pathfinding.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/2.png?raw=true :width: 600
Pathfinding with A*
The library uses the A* algorithm to find the shortest path from point A to point B. The path is drawn on the map using a customizable style.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/3.png?raw=true :width: 600
Draw Dots
Optional dots can be placed on the map (e.g., for points of interest, the player, markers).
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/4.png?raw=true :width: 600
Divide into Grid Squares
The image is divided into equal squares based on the grid_size
parameter.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/5.png?raw=true :width: 600
Reveal Explored Areas
A mask overlays the map. Areas near the travel path or manually unlocked via Map.unlock_point
are revealed in circular zones.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/6.png?raw=true :width: 600
Fill Transparent Areas
Any remaining transparent pixels are filled with a background layer.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/7.png?raw=true :width: 600
Final Map Output
The completed map shows explored areas, paths, markers, and hidden regions yet to be discovered.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/8.png?raw=true :width: 600
You can define special grid points where the reveal radius is larger — perfect for cities or key landmarks.
The library supports tons of styles for different themes and usecases.
.. image:: https://github.com/Kile/rpg_map/blob/master/assets/9.png?raw=true :width: 300 .. image:: https://github.com/Kile/rpg_map/blob/master/assets/10.png?raw=true :width: 300 .. image:: https://github.com/Kile/rpg_map/blob/master/assets/11.png?raw=true :width: 300 .. image:: https://github.com/Kile/rpg_map/blob/master/assets/12.png?raw=true :width: 300
Check out these demos:
examples/static_poc.py <https://github.com/Kile/rpg_map/blob/master/examples/static_poc.py>
_ – Generate one image from your codeexamples/pygame_poc <https://github.com/Kile/rpg_map/blob/master/examples/pygame_poc.py>
_ – Interactively do pathfinding to wherever you clickexamples/readme.py <https://github.com/Kile/rpg_map/blob/master/examples/readme.py>
_ – The code used to generate the final image in the steps breakdown in this READMEWe welcome contributions and ideas! If you'd like to work on rpg_map
locally, here's how to get started.
Compile the Rust Extension Locally
Use maturin
to build and install the Rust extension module in your local Python environment:
.. code:: bash
maturin develop --features "extension-module"
Generate Python Typings ( .pyi
)
The library includes a binary that auto-generates Python type stubs. Run it with:
.. code:: bash
cargo run --bin stub_gen --features stubgen
Build the Documentation
The documentation uses Sphinx and can be built locally as follows:
.. code:: bash
python3 -venv env && source env/bin/activate cd docs pip3 install -r requirements.txt sphinx-apidoc -o source/ ../ -f make html
The output will be available in the docs/build/html/
directory.
pyo3
to create Python bindings — see Cargo.toml
for feature flags and build options.stub_gen
tool, ensuring compatibility with type checkers and IDEs. Interestingly sphinx uses the docs defined in the Rust code though, the pyi
file is only for IDE type hinting when using the library.MIT
FAQs
A zero dependency, lightweight and fast library to manipulate RPG images written in Rust.
We found that rpg-map demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.