Skip to main content

An internal project for Intek Institute

Project description

Intro:

  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.

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

  FOR DEVELOPMENT:

  Step 1: Clone or Downloads the project, using this command:
 git clone http://gitlab-students.int.intek.edu.vn/sprite-sheet/vdinh.git
  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.

Contact:

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

Contributors:

    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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spriteutilkhangvu-1.0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file spriteutilkhangvu-1.0.4.tar.gz.

File metadata

  • Download URL: spriteutilkhangvu-1.0.4.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for spriteutilkhangvu-1.0.4.tar.gz
Algorithm Hash digest
SHA256 534ca1d9848565e111f913dd3c7d3f7fe883b6ba870e2e41e0c9ba8946066806
MD5 904e596aea4f3fc20dd56390e7b605f4
BLAKE2b-256 4218392574f03aa8b5fcd17bbc7fe67ee70340ae05df226700b3803ed3c2d3d3

See more details on using hashes here.

File details

Details for the file spriteutilkhangvu-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: spriteutilkhangvu-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for spriteutilkhangvu-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5e99560d2cfda2e6d5082e03169d529b9a673f6c42ab7843a2ac6feeb96ee752
MD5 13c9c06482d2258f53640d1af5dc719e
BLAKE2b-256 ce4b4085e764147843012c786d23bcaaddcd6f5a4a805fef52d45c0556ebf039

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page