Skip to main content

A lightweight wrapper around pillow for making games with images

Project description

ImgGameLib

A light wrapper around pillow designed for the making of games through generating images.

This is useful in several scenarios in which you are very limited, such as with discord bots.

Example

# Import the module
import ImgGameLib as igl

# Create a canvas
canvas = igl.Canvas(
    100,
    100,
    bg_color="#99CDDE",
    gif=True
)

# Create a 100x100 rectangle at (50,50) and draw it
rect = igl.Rectangle(
    50,
    50,
    100,
    100
)
rect.draw(canvas)

# Move the rectangle by 5 pixels on the x axis
rect.move(x=5)

# Save the first frame to frame_1.png, and discard all animated frames
canvas.save("frame_1.png", no_gif=True)
canvas.discard()

# Move the rectangle by 10 pixels on the x axis, 10 times
for _ in range(10):
    rect.move(x=10)

# Save the animation after that to animation.gif
canvas.save("animation.gif", loop=True, duration=20)

See the examples folder for more examples.

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

ImgGameLib-0.2.1.tar.gz (7.0 kB view hashes)

Uploaded source

Built Distribution

ImgGameLib-0.2.1-py3-none-any.whl (20.5 kB view hashes)

Uploaded py3

Supported by

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