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.
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
- Create a new animation class by subclassing BaseAnimation.
- Implement the apply() method to return a list of frames.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gifanimator-1.0.7.tar.gz.
File metadata
- Download URL: gifanimator-1.0.7.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8167b5395c5d2fb2993ed5d0fbb1e1ef2accb00c6740dcdcca64798a9de2d3a4
|
|
| MD5 |
9d8ac726df7f2cfc9bfb1c839a7a88d1
|
|
| BLAKE2b-256 |
16e2d1c8f7ef56f979a5fbdc8d40e72b07ed8dfffff2380c8e7ce551c6dd7510
|
File details
Details for the file gifanimator-1.0.7-py3-none-any.whl.
File metadata
- Download URL: gifanimator-1.0.7-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5b618b7e83b98cedfd99301bc29e26a2b369bacc595c86d716fb927d8ce4249
|
|
| MD5 |
5ab072578c07fb4fe14d20b9f47c9a36
|
|
| BLAKE2b-256 |
a855f84bad9476051d292ab30f55693b306316cebe84fc3b6adab11f241b0278
|