Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Utilities for finding sprites in a sprite sheet

Project description

Spriteutils

Spriteutils is small project to determine Sprites (specified by there unique label mask and bounding box) in the given Sprite Sheet.

A Sprite is a small raster graphic (a bitmap) that represents an object

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

This project is a tool to determine sprites (specified by there unique mask and bounding box) in the given Sprite Sheet.

Installaltion:

Prequisites: Python 3.7

$ pip install spriteutils-pkg

Documentation

After install the package, open python (python version must be >= 3.7)

$ python

Import the package and using method help to read the document

>>> from spriteutils import SpriteSheet
>>> help(SpriteSheet)

Functional test

Replicate the following step in python

# Import the package
>>> from spriteutils import SpriteSheet
# Specified the image file path name or create a PIL image
>>> image = "path/to/your/image"
# Create sprite sheet object
>>> sprite_sheet = SpriteSheet(image)
# Find all the sprites of the sprite sheet
>>> sprites ,label_map = sprite_sheet.find_sprites()
# Draw sprite masks for each sprite in the sprite sheet
>>> image = sprite_sheet.create_sprite_labels_image()
# Show the sprite masks image
>>> image.show()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for spriteutils-pkg, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size spriteutils_pkg-2.0.0-py3-none-any.whl (8.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size spriteutils-pkg-2.0.0.tar.gz (7.7 kB) File type Source Python version None Upload date Hashes View

Supported by

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