Skip to main content

Creates GIF animations from .PGN chess games

Project description

Chess Game Animation

This project generates an animated GIF of a chess game from a PGN file.

Features

  • Parses PGN files to extract moves
  • Generates board images for each move
  • Creates an animated GIF showing the game's progression

Installation

Conda (Recommended)

Install dependencies and activate the environment

conda create -n chess-animation -c conda-forge cairo pango gdk-pixbuf ffmpeg python-chess pillow imageio cairosvg
conda activate chess-animation

Install chessanimate with Pip

```sh
git clone https://github.com/djstompzone/chessanimate ~/chessanimate
cd ~/chessanimate
pip install .

Manual Installation with Pip

Install python dependencies

pip install python-chess pillow imageio cairosvg

Install chessanimate

git clone https://github.com/djstompzone/chessanimate ~/chessanimate
cd ~/chessanimate
pip install .

You'll also need to manually install system dependencies

# Debian/Ubuntu
sudo apt install libcairo2-dev libjpeg-dev libgif-dev

# macOS
brew install cairo

Usage

Requires a PGN file (e.g., game.pgn)

Basic Usage

python -m chessanimate game.pgn

The output will be saved as chess_animation.gif.

Customization

To customize the frame duration

python -m chessanimate game.pgn -d 500

To specify the output filenane

python -m chessanimate game.pgn -o animation.gif

For a full list of arguments, you can view the help

python -m chessanimate --help

Dependencies

  • python-chess - Chess board rendering & PGN parsing
  • Pillow - Image processing
  • imageio - GIF creation
  • cairosvg - Converts SVG to PNG
  • Cairo - Required for SVG rendering

Output Example

Example GIF

License

MIT License.

Credits

Author: DJ Stomp Repo: GitHub - chessanimate

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

chessanimate-0.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

chessanimate-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file chessanimate-0.0.1.tar.gz.

File metadata

  • Download URL: chessanimate-0.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.2 Linux/6.2.1-PRoot-Distro

File hashes

Hashes for chessanimate-0.0.1.tar.gz
Algorithm Hash digest
SHA256 da255c4c1773f5da668602209a922279bf287b0f210d8809484db0969c48f2ab
MD5 a7edf411bb2ad0c0951dacc1885ecc9d
BLAKE2b-256 50faba54b088a371130036530554dcda535bf5ccc1622b4e645cd0d6c96a2e6a

See more details on using hashes here.

File details

Details for the file chessanimate-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: chessanimate-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.2 Linux/6.2.1-PRoot-Distro

File hashes

Hashes for chessanimate-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 085463c413c1866e7961400d5643562f3e04b49be708c8eaa8905c4cc9e4ebe0
MD5 af10113fd87e057df8ccd85f226fd0ee
BLAKE2b-256 1620ba9255c4632f6f874670b9e9658a5180120cad03da0ebc49802dd1ce1b3f

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