Skip to main content

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

  1. Download and install Python 3 for your architecture
  2. Install the latest version of PySheeter with pip3
$ pip3 install pysheeter-VicW

Sprite sheet from folder

  1. Import Sheet from pysheeter
from pysheeter import Sheet
  1. Initialize the class with a path to your PNG-folder
spritesheet = pysheeter.Sheet("example/")
  1. 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)

Example 1 Example 2

Sprite sheet from individual PNG-images

  1. Import Sheet from pysheeter
from pysheeter import Sheet
  1. Initialize the class without any arguments
spritesheet = pysheeter.Sheet()
  1. Add PNG-images with add()
spritesheet.add("example/1.png")
spritesheet.add("example/2.png")
spritesheet.add("example/3.png")
...
  1. Remove PNG-images with remove()
spritesheet.remove("example/2.png")
  1. 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)

Example 1 Example 2

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 pysheeter, version 1.0.6
Filename, size File type Python version Upload date Hashes
Filename, size pysheeter-1.0.6-py3-none-any.whl (15.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pysheeter-1.0.6.tar.gz (2.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