Spriteutil is a package contain SpriteSheet Class that can detect and create a new image contain the original image sprites
Project description
Spriteutils Package
Spriteutil is a package contain SpriteSheet Class that can detect and create a new image contain the original image sprites.
Installation:
>>> pip install sprite-utils==2.0.1
Usage:
>>> from sprite_util_ndthinh.spriteutil import SpriteSheet
>>> sprite_sheet = SpriteSheet('Barbarian.gif')
>>> sprites, labels = sprite_sheet.find_sprites()
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 404, in find_sprites
File "<input>", line 249, in background_color
File "<input>", line 324, in find_most_common_color
ValueError: 'The image mode 'P' is not supported
>>> # GIF images are 8-bit pixels using a color palette. We need to
>>> # convert our image to `RGB`.
>>> from PIL import Image
>>> image = Image.open('Barbarian.gif').convert('RGB')
>>> sprite_sheet = SpriteSheet(image)
>>> sprites, labels = sprite_sheet.find_sprites()
>>> len(sprites)
39
>>> # Create the mask image with bounding boxes.
>>> image = sprite_sheet.create_sprite_labels_image()
>>> image.save('barbarian_bounding_boxes.png')
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
sprite_utils-2.0.1.tar.gz
(4.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sprite_utils-2.0.1.tar.gz.
File metadata
- Download URL: sprite_utils-2.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a0843e1af738f495468397e3238a6af88e464546d7e755d4e634420303273fc
|
|
| MD5 |
2a6c8e0dd04773fa605590bc6d6e86a9
|
|
| BLAKE2b-256 |
0453eccb8a3c7106e209ef910212b8149a5f62b99cc09ecfa4ee2b6bbd537594
|
File details
Details for the file sprite_utils-2.0.1-py3-none-any.whl.
File metadata
- Download URL: sprite_utils-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96c4d9f624865e0b7db1c1d9830f7be82eeb0a473c9bf3862328080517b5fb1f
|
|
| MD5 |
4075a1f19f5e5bf0b1bbcfd1d1eb79c7
|
|
| BLAKE2b-256 |
f9534931b56acf5d37764f637dc5decb3a1b318129c83ea17fb63a2ef5521cee
|