> ## Documentation Index
> Fetch the complete documentation index at: https://docs.summerengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overlay (Painted 25d world skill)

> overlay.py from the Painted 25d world skill in the Summer Engine skill library. Build a 2D or 2.5D game as a painted world: a 3D blockout under one fixed camera, an AI paint-over projected onto it, sprite characters.

> [!NOTE]
>
> Part of the [`painted-25d-world` skill](/skills/painted-25d-world). The skill links here when your agent needs the detail.

```python overlay.py theme={null}
"""Alignment check: red edges of the blockout render over the paint-over. Roof lines, wall corners and props must
sit on the red lines; reject a painting that moved, added or zoomed anything. Needs Python with Pillow and numpy.
usage: python3 overlay.py <blockout.png> <painting.png> <out.png>"""
import sys

import numpy as np
from PIL import Image, ImageFilter

block, paint, out = sys.argv[1:4]
p = Image.open(paint).convert("RGB")
b = Image.open(block).convert("RGB").resize(p.size, Image.NEAREST)
a = np.asarray(b).astype(int)
e = (np.abs(np.diff(a, axis=0, prepend=a[:1])).sum(2) > 40) | (np.abs(np.diff(a, axis=1, prepend=a[:, :1])).sum(2) > 40)
e = np.asarray(Image.fromarray((e * 255).astype(np.uint8)).filter(ImageFilter.MaxFilter(3))) > 0
o = np.asarray(p).copy()
o[e] = [255, 0, 0]
Image.fromarray(o).save(out)
```

***

Source: [`library/skills/painted-25d-world/_building-blocks/tools/overlay.py`](https://github.com/SummerEngine/summer/blob/main/library/skills/painted-25d-world/_building-blocks/tools/overlay.py), rendered from `summer-engine@4.5.0` on npm.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.