Chess GIF Generator for Python
Project description
Introduction
Generate a GIF of a chess game from a PGN with optional:
Analysis bar
Analysis chart
Numerical Annotation Glyphs (NAGs)
Move and check arrows
PGN module to add engine evaluations and calculate ACPL
Details on breaking changes in the 1.0.0 release
This release brings new features such as headers with player names, taken pieces and clocks, and Numeric Annotation Glyphs (NAGs).
The module was also restructured for easier usage and extensibility. Code using version 0.2.0 and earlier will not work with version 1.0.0 - minor changes will be required to get back up and running again.
Please see the examples and documentation for details.
Demo
GIF with all features enabled
import chess
import chess.engine
import chess.pgn
import io
from gifpgn import CreateGifFromPGN, PieceTheme, BoardThemes
from gifpgn.utils import PGN
pgn_string = ...
game = chess.pgn.read_game(io.StringIO(pgn_string))
if not PGN(game).has_analysis():
with chess.engine.SimpleEngine.popen_uci("/path/to/stockfish") as engine:
game = PGN(game).add_analysis(engine, chess.engine.Limit(depth=18))
g = CreateGifFromPGN(game)
g.piece_theme = PieceTheme.ALPHA
g.square_colors = BoardThemes.BLUE
g.enable_arrows()
g.add_headers(height=20)
g.add_analysis_bar()
g.add_analysis_graph()
g.enable_nags()
gif = g.generate("test_gif.gif")
Small GIF with no analysis
import chess.pgn
import io
from from gifpgn import CreateGifFromPGN, PieceTheme, BoardThemes
pgn_string = ...
game = chess.pgn.read_game(io.StringIO(pgn_string))
g = CreateGifFromPGN(game)
g.board_size = 240
g.piece_theme = PieceTheme.CASES
g.square_colors = BoardThemes.GREEN
g.generate("test_small_gif.gif")
Piece and Board Themes
Alpha Blue |
|
Cases Green |
|
Maya Brown |
|
Regular Purple |
Installing
Install with pip:
pip install gifpgn
Documentation
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 gifpgn-1.1.1.tar.gz.
File metadata
- Download URL: gifpgn-1.1.1.tar.gz
- Upload date:
- Size: 394.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
817502a823c52be2145ccb402b8626b339f0b8793dbed89ae6f68bc2fb3bc24b
|
|
| MD5 |
98e524d69d3cfe061ede96208cb45fe1
|
|
| BLAKE2b-256 |
c5e5ad259085be8be158b0270616a42fdf9d8f9bc20765381039d894cb686ff0
|
File details
Details for the file gifpgn-1.1.1-py3-none-any.whl.
File metadata
- Download URL: gifpgn-1.1.1-py3-none-any.whl
- Upload date:
- Size: 400.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
967b6181f52800c1d648ad377114cdbb8d8b91478875e3cbfa077661b3995539
|
|
| MD5 |
066fc2e68f2b75c484bb7eef2c90fdb1
|
|
| BLAKE2b-256 |
d5664a9daff1d7e3441863466ef6109b35cdbdb8279c7f083b4c713eeb9784d3
|