Skip to main content

A sprite detection package

Project description

Image Sprite Detection Module

What is it?

This is a Python module used for detection sprites from an image

Why use this module?

  • Easy to use: You just need to pass an image an get the result
  • Time saving: This module is already built so you don't need to spend time for it anymore!


  Create a SpriteSheet object using:

   SpriteSheet(fd, background_color=None):
@fd: the name and path (a string) that references an image file in the local file system;
OR a pathlib.Path object that references an image file in the local file system ; a file object that MUST implement read(), seek(), and tell() methods, and be opened in binary mode;
OR a Image object.

@background_color: an integer if the mode is grayscale;
OR a tuple (red, green, blue) of integers if the mode is RGB;
OR a tuple (red, green, blue, alpha) of integers if the mode is RGBA. The alpha element is optional. If not defined, while the image mode is RGBA, the constructor considers the alpha element to be 255.

  Class SpriteSheet provides following methods:

Find most used color in an Image object
arg: image: MUST be an Image object
Return most used color in the image with the same format image's mode
Create a mask image of initial image, and add a bounding box around each sprite,
each sprite also have an unique random uniform color.
Return an Image object.
Detect sprites inside the image
Return a 2D label map and a dict that stores:
key: sprite's label
value: its Sprite's object
arg: image: MUST be an Image object


The project require Python 3.7+ to run


  In Terminal, use command:
pip3 install spriteutil_final


  Clone or Downloads the project, using this command and then edit anything you want:
git clone

A Simple Example

from spriteutil_final.spriteutil import SpriteSheet
spritesheet = SpriteSheet('islands.png')
sprites, label_map = spritesheet.find_sprites()
img_mask = spritesheet.create_sprite_labels_image()'islands_label_mask.png')
img_mask_with_border = spritesheet.make_sprite_border_image()'islands_label_mask_with_border.png')


    During the usage of the project, if you have any question, please contact me personally at INTEK HCM City or via my email:


    Long LAM DUC from INTEK Institute, HCM City

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spriteutil-longlamduc, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size spriteutil_longlamduc-1.0.0-py3-none-any.whl (6.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size spriteutil_longlamduc-1.0.0.tar.gz (5.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page