Skip to main content

An internal project for Intek Institute

Project description


  The project is generally used for detecting sprites inside an sprite sheets, providing bounding box of each sprite. It can also detect most used color. It can also draw and colorize a mask from the initial image.


  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 spriteutilkhangvu
  Example for usage inside your project:
 from spriteutilkhangvu.spriteutil import SpriteSheet


  Step 1: Clone or Downloads the project, using this command:
 git clone
  Step 2: Install required libs and tools, using this command in Terminal:
	 pip3 install -r requirements.txt
  Step 3: Edit the source code as you wish.


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


    Khang VU 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.

Source Distribution

spriteutilkhangvu-1.0.4.tar.gz (6.3 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page