All Projects → niklasf → lila-gif

niklasf / lila-gif

Licence: AGPL-3.0 license
Webservice to render Gifs of chess positions and games, and stream them frame by frame

Programming Languages

rust
11053 projects
python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to lila-gif

lila-openingexplorer
Opening explorer for lichess.org that can handle all the variants and billions of unique positions
Stars: ✭ 89 (+41.27%)
Mutual labels:  chess, lichess, http-api
lila-tablebase
Tablebase server
Stars: ✭ 51 (-19.05%)
Mutual labels:  chess, lichess, http-api
liground
A free, open-source and modern Chess Variant Analysis GUI for the 21st century
Stars: ✭ 41 (-34.92%)
Mutual labels:  chess, lichess
chessground
Chessground React Wrapper
Stars: ✭ 15 (-76.19%)
Mutual labels:  chess, lichess
Lila
♞ lichess.org: the forever free, adless and open source chess server ♞
Stars: ✭ 10,315 (+16273.02%)
Mutual labels:  chess, lichess
should-i-play-f6
Chess project to analyze the statistical effect of playing f3 (as white) or f6 (as black) on the outcome of the game.
Stars: ✭ 15 (-76.19%)
Mutual labels:  chess, lichess
bot-o-tron
Try out lichess' bot interface
Stars: ✭ 36 (-42.86%)
Mutual labels:  chess, lichess
Pgn2gif
A small tool that generates gif of a chess game
Stars: ✭ 65 (+3.17%)
Mutual labels:  chess, gif
liPGN
This program uses the lichess REST API to retrieve all the games of a user and transform them into a big PGN file that you can then import into your favourite game analysis tool (ie. scid)
Stars: ✭ 14 (-77.78%)
Mutual labels:  chess, lichess
pgn-tactics-generator
Generate chess puzzles / tactics from a pgn file
Stars: ✭ 83 (+31.75%)
Mutual labels:  chess, lichess
chess-openings
An aggregated data set of chess opening names
Stars: ✭ 223 (+253.97%)
Mutual labels:  chess, lichess
stockfish.js
The strong open source chess engine Stockfish compiled to JavaScript and WebAssembly using Emscripten
Stars: ✭ 140 (+122.22%)
Mutual labels:  chess, lichess
chessops
Chess and chess variant rules and operations in TypeScript
Stars: ✭ 66 (+4.76%)
Mutual labels:  chess, lichess
cgolGo
Conway's Game of Life in Golang
Stars: ✭ 38 (-39.68%)
Mutual labels:  gif
gifter
Gif image renderer running in terminal.
Stars: ✭ 44 (-30.16%)
Mutual labels:  gif
ansible-vmware-http
Examples of Ansible playbook to manage VMware using HTTP APIs
Stars: ✭ 29 (-53.97%)
Mutual labels:  http-api
magic-bits
A C++ header-only library for efficient move generation in Chess using "magic bitboards" technique
Stars: ✭ 26 (-58.73%)
Mutual labels:  chess
coronate
A Swiss-style chess tournament management app.
Stars: ✭ 96 (+52.38%)
Mutual labels:  chess
dot-screencap
A screencapturing library
Stars: ✭ 31 (-50.79%)
Mutual labels:  gif
ChessLiteGUI
A lightweight Chess GUI for playing Chess on a personal computer.
Stars: ✭ 2 (-96.83%)
Mutual labels:  chess

lila-gif

Test

Webservice to render Gifs of chess positions and games, and stream them frame by frame.

Example: DrDrunkenstein vs. Zhigalko_Sergei

size render time frames colors width height
336 KiB ~60 ms 93 63 720 px 840 px

Usage

lila-gif

USAGE:
    lila-gif [OPTIONS]

OPTIONS:
        --bind <BIND>    Listen on this address [default: 127.0.0.1:6175]
    -h, --help           Print help information

HTTP API

GET /image.gif

curl http://localhost:6175/image.gif?fen=4k3/6KP/8/8/8/8/7p/8 --output image.gif
name type default description
fen ascii starting position FEN of the position. Board part is sufficient.
white utf-8 none Name of the white player. Known chess titles are highlighted. Limited to 100 bytes.
black utf-8 none Name of the black player. Known chess titles are highlighted. Limited to 100 bytes.
comment utf-8 https://github.com/lichess-org/lila-gif Comment to be added to GIF meta data. Limited to 255 bytes.
lastMove ascii none Last move in UCI notation (like e2e4).
check ascii none Square of king in check (like e1).
orientation white Pass black to flip the board.

POST /game.gif

{
  "white": "Molinari", // optional
  "black": "Bordais", // optional
  "comment": "https://www.chessgames.com/perl/chessgame?gid=1251038", // optional
  "orientation": "white", // default
  "delay": 50, // default frame delay in centiseconds
  "frames": [
    // [...]
    {
      "fen": "r1bqkb1r/pp1ppppp/5n2/2p5/2P1P3/2Nn2P1/PP1PNP1P/R1BQKB1R w KQkq - 1 6",
      "delay": 500, // optionally overwrite default delay
      "lastMove": "b4d3", // optionally highlight last move
      "check": "e1" // optionally highlight king
    }
  ]
}

GET /example.gif

curl http://localhost:6175/example.gif --output example.gif

Render an example game.

Technique

Instead of rendering vector graphics at runtime, all pieces are prerendered on every possible background. This allows preparing a minimal color palette ahead of time. (Pieces are not just black and white, but need other colors for anti-aliasing on the different background colors).

Sprite

All thats left to do at runtime, is copying sprites and Gif encoding. More than 95% of the rendering time is spent in LZW compression.

For animated games, frames only contain the changed squares on transparent background. The example below is the last frame of the animation.

Example frame

License

lila-gif is licensed under the GNU Affero General Public License, version 3 or any later version, at your option.

The generated images include text in Noto Sans (Apache License 2.0) and a piece set by Colin M.L. Burnett (GFDL or BSD or GPL).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].