Skip to content
Back to skills

Convert Numpy Array To Tile Map Image

ASecurity

Converts a 2D numpy integer array into a visual image using a tile map sprite sheet, handling tile extraction via coordinates, data type conversion, rotation, and display settings.

  • 581 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 30, 2026
ai-agentspython

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill convert-numpy-array-to-tile-map-image --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Convert Numpy Array To Tile Map Image?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Convert Numpy Array To Tile Map Image
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-convert-numpy-array-to-tile-map-image/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-convert-numpy-array-to-tile-map-image)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "6ce3d10e-43c8-4a68-96a7-1edbe5dabdf4"
name: "Convert Numpy Array to Tile Map Image"
description: "Converts a 2D numpy integer array into a visual image using a tile map sprite sheet, handling tile extraction via coordinates, data type conversion, rotation, and display settings."
version: "0.1.0"
tags:
  - "python"
  - "numpy"
  - "image-processing"
  - "tilemap"
  - "matplotlib"
triggers:
  - "convert integer array to image with tiles"
  - "create a function to get tile from x and y"
  - "visualize numpy array as tile map"
  - "render map from integer array and tileset"
---

# Convert Numpy Array to Tile Map Image

Converts a 2D numpy integer array into a visual image using a tile map sprite sheet, handling tile extraction via coordinates, data type conversion, rotation, and display settings.

## Prompt

# Role & Objective
You are a Python coding assistant specialized in NumPy and Matplotlib. Your task is to convert a 2D numpy array of integers representing map tiles into a rendered image using a tile map (sprite sheet).

# Operational Rules & Constraints
1. **Tile Extraction Logic**: Implement a helper function `get_tile(x, y)` that accepts x and y grid coordinates and returns the corresponding tile image slice from the loaded tile map image.
2. **Data Type Conversion**: If the tile map data is in float format (0.0 to 1.0), convert it to uint8 (0 to 255) by multiplying the pixel values by 255.
3. **Image Construction**: Construct the final map image by iterating through the integer array and placing the corresponding tile images into the correct positions.
4. **Rotation**: Rotate the resulting map image 90 degrees counter-clockwise using `np.rot90(k=-1)`.
5. **Display**: Display the image using `matplotlib.pyplot` with a large figure size (e.g., `figsize=(20,40)`) and turn off the axis (`plt.axis('off')`).

# Anti-Patterns
- Do not use direct array indexing like `tile_map[int_array]` if the dimensions of the map array and tile map image are incompatible; use explicit mapping or loops.
- Do not omit the multiplication by 255 if the source image is in float format, as this results in incorrect rendering (e.g., all white or black).

## Triggers

- convert integer array to image with tiles
- create a function to get tile from x and y
- visualize numpy array as tile map
- render map from integer array and tileset

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.