Skip to main content

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

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.





Metadata

Release files for gifanimator 1.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gifanimator 1.0.8
File Size Uploaded
gifanimator-1.0.8.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gifanimator 1.0.8
File Interpreter ABI Platform
gifanimator-1.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / gifanimator-1.0.8.tar.gz

Download URL gifanimator-1.0.8.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
dbe8dbb64f03ad5b2858531c68191a1b1b68f6f3a85797048f5c36fb7966c060
BLAKE2b-256 checksum
How to use checksums
326a5e2a07bf6209b5605310336f34b8dc048b8f1ab6f69b957952e29aa97cd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.8 Windows/11

Release files / gifanimator-1.0.8-py3-none-any.whl

Download URL gifanimator-1.0.8-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc69558da984640bfb4d09d9b875cb72918162ce8641479c01a8b583e83d2d3d
BLAKE2b-256 checksum
How to use checksums
5e69e18665a4116d6883c9e58f7e8f8cf58126c2d696c8f2ad8354b4e137acc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.12.8 Windows/11

Release history Release notifications | RSS feed

This release

1.0.8 This release

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page