Skip to main content

Sprites Detection

A sprite is a small raster graphic (a bitmap) that represents an object such as a character, a vehicle, a projectile, etc.

Sprite Sheet

It is not uncommon for games to have tens to hundreds of sprites. Loading each of these as an individual image would consume a lot of memory and processing power. To help manage sprites and avoid using so many images, many games use sprite sheets (also known as image sprites).

A sprite sheet consists of multiple sprites in one image. In other words, sprite sheets pack multiple sprites into a single picture. Using sprite sheet, video game developers create sprite sheet animation representing one or several animation sequences while only loading a single file:

Metal Slug Sprites

Sprite Bounding Box

A frame (bounding box) can be used to delimit the sprite in the sprite sheet. This bounding box is defined with two 2D points top_left and the bottom_right, which their respective coordinates x and y are relative to the top-left corner of the sprite sheet's image.

For example:

Shape Bounding Boxes

Sprite Mask

The mask of a sprite defines the 2D shape of the sprite. For example, the sprite sheet contains 3 following sprites:

Metal Slug Standing Stance

The masks of these sprites are respectively:

Aim of the project

  • Detect sprites packed in an image (sheet) and draw their masks and bounding boxes into a new image with the same size of the original image.
  • Present a 2D map of all the the sprites with their labels.

Usage Information

Prerequisites

  • Python 3.6 is required.
  • pip is requied, to install sudo apt install pip

Usage

  • pip install Friendlyngoc from your terminal

  • Example of functioning:

    • Input as a spritesheet '3.png'

    • A image with sprite masks 'spritesheet.png'

    >>> from Friendlyngoc_spriteutil.spriteutil import SpriteSheet
    >>> sprite_sheet = SpriteSheet('spritesheet.png')
    >>> sprites, labels = sprite_sheet.find_sprites()
    >>> len(sprites)
    22
    >>> # Create the mask image with bounding boxes.
    >>> image = sprite_sheet.create_sprite_labels_image()
    >>> image.save('sprites_masks.png')
    

Contact Information

  • Email: Email: ngoc.dang@f4.intek.edu.vn
  • Phone number: Phone: (+84) 90 690 2056

Metadata

Release files for Spriteutils-Ngoc-Dang 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Spriteutils-Ngoc-Dang 1.0.7
File Size Uploaded Provenance Actions
Spriteutils_Ngoc_Dang-1.0.7.tar.gz 8.9 kB Without provenance Details for Spriteutils_Ngoc_Dang-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Spriteutils-Ngoc-Dang 1.0.7
File Interpreter ABI Platform Actions
Spriteutils_Ngoc_Dang-1.0.7-py3-none-any.whl Python 3 none any Details for Spriteutils_Ngoc_Dang-1.0.7-py3-none-any.whl

Total release size: 18.8 kB

Release files / Spriteutils_Ngoc_Dang-1.0.7.tar.gz

Download URL Spriteutils_Ngoc_Dang-1.0.7.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9ed72493f96023f271b823bfd446d2200ec4c7f7689773027999614a044efec0
BLAKE2b-256 checksum
How to use checksums
5c9c56f79cc75f736b5a50f6e6aee58388974c0ee12c1f31304136b40ac0460f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

Release files / Spriteutils_Ngoc_Dang-1.0.7-py3-none-any.whl

Download URL Spriteutils_Ngoc_Dang-1.0.7-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28812003411d6097ebd577235549b91b7f00f0d307e91006e055c35cb8d1d6ab
BLAKE2b-256 checksum
How to use checksums
20e9f1996d8b3ef5a3c3e6817f00107f1a1aeb3bca6b6cddf86734998511144d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.9

Security for Spriteutils-Ngoc-Dang 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page