This tool scans each pixel of a given image and groups similar pixels together by labelling them with the same number. The "similarity" is determined by a user-defined tolerance of the pixel's RGB closeness, with the logic:
Imnum will then generate a pdf of the labelled picture. It can either do this with all of the groups labelled on a single picture, or it can split each group into its own page to better see each separate number. Great for pixel art, painting, or general image analysis.
The following are example outputs of analyzed images from the video game Minecraft (with a tolerance of 20).
| All-in-One | Expanded View | ||||
|---|---|---|---|---|---|
![]() |
|
||||
![]() |
|
After cloning the git repository, run the following commands:
(For first time pipenv use)
pip install pipenvFollowed by:
cd imnum
pipenv installOnce your environment is set up, you can start the venv and run the script:
pipenv shell
python imnum.py /path/to/image.pngImnum accepts most common image formats. See the skimage documentation for more details.
Flags can also be set to further customize the output.
-for--font_sizeto change the font size of the overlayed numbers. Defaulted at 6.-eor--expandto have the expanded view output.-sor--scaleto downscale the image prior to analyzing the pixels.-tor--toleranceto adjust how similar the pixel colors can be for them to be grouped in the same category. Defaulted at 25.
For example, to get the above outputs, I used:
python imnum.py bust.png -s 10 -t 20
python imnum.py sunset.png -s 10 -t 20for the standard view, and:
python imnum.py bust.png -s 10 -t 20 -e
python imnum.py sunset.png -s 10 -t 20 -e
for the expanded view.









