Lightweight Python-script to create sprite sheets from transparent PNGs with Pillow
Project description
PySheeter
Lightweight Pillow Python-script to create and scale sprite sheets from PNGs in folders or individually
Get started / Basic usage
- Download and install Python 3 for your architecture
- Install the latest version of PySheeter with
pip3
$ pip3 install pysheeter-VicW
Sprite sheet from folder
- Import
Sheet
frompysheeter
from pysheeter import Sheet
- Initialize the class with a path to your PNG-folder
spritesheet = pysheeter.Sheet("example/")
- Create a sprite sheet with
put()
spritesheet.put("example_v1616.png",(16,16))
# Creates a vertical spritesheet named 'example_v1616.png' with the dimensions 16x16px (scaled automatically)
Example usage:
# from 'example.py'
from pysheeter import PySheeter
# Load sprites from 'example/'
spritesheet = PySheeter.Sheet("example")
# Create a vertical spritesheet with the dimensions 16x16
spritesheet.put("example_v1616.png",(16,16))
# Create a horizontal spritesheet with the dimensions 16x32
spritesheet.put("example_h1632.png",(16,32),False)
Sprite sheet from individual PNG-images
- Import
Sheet
frompysheeter
from pysheeter import Sheet
- Initialize the class without any arguments
spritesheet = pysheeter.Sheet()
- Add PNG-images with
add()
spritesheet.add("example/1.png")
spritesheet.add("example/2.png")
spritesheet.add("example/3.png")
...
- Remove PNG-images with
remove()
spritesheet.remove("example/2.png")
- Create a sprite sheet with
put()
spritesheet.put("example_v1616.png",(16,16))
# Creates a vertical spritesheet named 'example_v1616.png' with the dimensions 16x16px (scaled automatically)
Example usage:
from pysheeter import PySheeter
# Load sprites from 'example/'
spritesheet = PySheeter.Sheet()
# Add PNG-images
spritesheet.add("example/1.png")
spritesheet.add("example/2.png")
spritesheet.add("example/3.png")
spritesheet.add("example/7.png")
spritesheet.add("example/5.png")
spritesheet.add("example/9.png")
# Create a vertical spritesheet with the dimensions 16x16
spritesheet.put("example_v1616.png",(16,16))
# Create a horizontal spritesheet with the dimensions 16x32
spritesheet.put("example_h1632.png",(16,32),False)
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
pysheeter-1.0.5.tar.gz
(2.7 kB
view hashes)
Built Distribution
pysheeter-1.0.5-py3-none-any.whl
(15.3 kB
view hashes)
Close
Hashes for pysheeter-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0df806e782666c94636e200ffc6105eeee1419072edf573c99a4a00bd8bc743 |
|
MD5 | 952a63dcff13f097b52815e2f2661585 |
|
BLAKE2b-256 | 8f8f12c6cb56257219211ccb851c85e8d5e0bffd8eafbe351c015d146461b41d |