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-1.0.0.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-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chessanimate-1.0.0.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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7bf6a3d166c5b1c4833d70584058910fa8c08507f9a290f1786056953169cb9f
MD5 4bfa6555f37e6a13ae2759587114376a
BLAKE2b-256 82ea548aea13f9e28fefe066c24dce1f3f62fe151dcb883b25ce61c0820b1948

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chessanimate-1.0.0-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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ed20243e9f9965a4955c02fe9a24de6e3d2e579d3a99e3ea897e3de5ebe138c
MD5 f457957b05e0b0234aae796f544d5981
BLAKE2b-256 5513711c3d1c521d21c3237ad17fe7f45b66b3140a4a282237e87f3c8d06f5f0

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