Skip to main content

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!

Usage:

  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:

   SpriteSheet.find_most_common_color(image):
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
   SpriteSheet.object.create_sprite_labels_image():
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.
   SpriteSheet.object.find_sprites():
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

Installation:

The project require Python 3.7+ to run

  FOR USER:

  In Terminal, use command:
pip3 install spriteutil_final

  FOR DEVELOPMENT:

  Clone or Downloads the project, using this command and then edit anything you want:
git clone https://github.com/intek-training-jsc/sprite-detection-longlamduc.git

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()
img_mask.save('islands_label_mask.png')
img_mask_with_border = spritesheet.make_sprite_border_image()
img_mask.save('islands_label_mask_with_border.png')

Contact:

    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@f4.intek.edu.vn

Contributors:

    Long LAM DUC from INTEK Institute, HCM City

Metadata

Release files for spriteutil-longlamduc 1.0.0

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

Source distribution (sdist)

Source distribution for spriteutil-longlamduc 1.0.0
File Size Uploaded Provenance Actions
spriteutil_longlamduc-1.0.0.tar.gz 5.0 kB Without provenance Details for spriteutil_longlamduc-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spriteutil-longlamduc 1.0.0
File Interpreter ABI Platform Actions
spriteutil_longlamduc-1.0.0-py3-none-any.whl Python 3 none any Details for spriteutil_longlamduc-1.0.0-py3-none-any.whl

Total release size: 11.3 kB

Release files / spriteutil_longlamduc-1.0.0.tar.gz

Download URL spriteutil_longlamduc-1.0.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed35a92c25bc712e32543b6afa0c15f0702eb0d9f9ac769e251caa27ee79ec45
BLAKE2b-256 checksum
How to use checksums
c5a47a7299f85f6f0a5739d302e0b4fa4992c52bc49f9bca95818265c573b8c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

Release files / spriteutil_longlamduc-1.0.0-py3-none-any.whl

Download URL spriteutil_longlamduc-1.0.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
782ba97a023151c7c8e13411aac76eefea68711b36c9156d9c386380859beb05
BLAKE2b-256 checksum
How to use checksums
4d329803536ac7cad583ba07ea3399b5b8647a6bafc7b18224419eb5f7748040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

Security for spriteutil-longlamduc 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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