Skip to main content

Extensible library for applying animated effects to still images and generating GIFs

Project description

GIF Animator

A Python library for applying animated effects to still images and generating GIFs with alpha transparency.

License: MIT

Features

  • Extensible API: Easily add new animation effects.
  • Preserves Transparency: Ensures smooth rendering with RGBA images.
  • CLI Support: Apply effects from the command line.

Supported Animations

At this time, supported animations are:

  • Jitter: Adds a random shaking effect to images.

Installation

Via PyPi

(Coming soon)

pip install gifanimator

Via GitHub (developers)

Clone the repository and install dependencies:

git clone https://github.com/DJStompZone/gifanimator.git
cd gifanimator
pip install .

Usage

CLI Usage

Generate a jittery animated GIF:

gifanimator input.png output.gif --params '{"effect": "jitter", "duration": 2, "params": {"frames": 10, "max_shift": 5}}'

Generate a really jittery animated GIF:

gifanimator input.png output.gif --params '{"effect": "jitter", "duration": 2, "params": {"frames": 10, "max_shift": 5}}'  --params '{"effect": "jitter", "duration": 4, "params": {"frames": 30, "max_shift": 15}}'

Note: As seen above, multiple effects can be applied by appending more than one --params argument

Programmatic Usage

from PIL import Image
from gifanimator.jitter_animation import JitterAnimation
from gifanimator.gif_animator import GIFAnimator

img = Image.open("input.png").convert("RGBA")

effect = JitterAnimation(frames=10, max_shift=5)
animator = GIFAnimator(effect)

animator.generate_gif(img, "output.gif")
print("GIF saved as output.gif")

Contributions

Adding New Effects

  1. Create a new animation class by subclassing BaseAnimation.
  2. Implement the apply() method to return a list of frames.
  3. Register the effect in ANIMATION_CLASSES in main.py.

Example:

class MyCustomAnimation(BaseAnimation):
    def apply(self, image):
        # Custom frame processing logic
        return [image]  # Return modified frames

Running Tests

Ensure everything works as expected with:

pytest tests

License

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.

Source Distribution

gifanimator-1.0.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gifanimator-1.0.5-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file gifanimator-1.0.5.tar.gz.

File metadata

  • Download URL: gifanimator-1.0.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.8 Windows/11

File hashes

Hashes for gifanimator-1.0.5.tar.gz
Algorithm Hash digest
SHA256 9a6aa8c8cd39ead656a1a4fbf43662901f9793181526d1017d13e6a76d41c1cd
MD5 ad735c19818458c3aa7abac16ff01aec
BLAKE2b-256 d2802c96445168330bec39cc2f321b421f0740a02b5deed11b246d7a514b3644

See more details on using hashes here.

File details

Details for the file gifanimator-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: gifanimator-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.8 Windows/11

File hashes

Hashes for gifanimator-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 949fb2353ad28b5e436488a85a099935867191b32da24ecfad1e4a39b1835800
MD5 6b7faaf532a0adc82fdf6a8ad6dcf58f
BLAKE2b-256 7e41d8a353b3a0f3cde8dd3c4356706f2471606acdbf096bed6fe93560dd7cef

See more details on using hashes here.

Supported by

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