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 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page