Durden is a program that identifies, counts and, optionally, marks and/or cuts out and saves unique tiles in a given image file.
A friend was working on game graphics for a 16-bit console game and asked if I could write a program for dealing with tiled background graphics. Several programs already provide this kind of functionality, but it sounded like it'd be fun to write and I don't mind reinventing wheels on my spare time if I get some enjoyment out of it.
The algorithm used is naïve and fairly slow, but it does the job and should work "fast enough" for the low pixel counts usually involved in retro game making.
Durden was written and tested in Python 3.6. It requires PIL (the Python Imaging Library). It has been linted with these settings.
The latest release is v1.0 (2022-03-27).
- Download the main distribution archive (durden10.tgz, ~4k)
- Read the source code of the main program.
Say we've got some cool game graphics, like this:
The image has been scaled up for educational purposes.
Let's assume this file is called
If we wanted to mark and save all 8x8 pixel tiles in this image,
we could invoke durden like this:
$ durden tileman.png wh=8 save mark m=2
This means find all 8x8 pixel tiles (
save all unique tiles in an automatically
mark all repeating tiles with color
index 2 (
m=2) and save the result in a copy of the
We'll be presented with the following output:
Number of 8 * 8 tiles in 'tileman.png': 41 Marked image saved as marked_tileman.png Tiles saved in tileman.png_tiles
In the newly created directory
find the files
all of them 8x8 PNG files.
In the file
marked_tileman.png we'll see all repeating tiles
blocked out by our selected color index 2, like so:
More usage information is available in the included documentaion.