{"id":20804962,"url":"https://github.com/lichess-org/lila-gif","last_synced_at":"2025-04-05T12:04:22.231Z","repository":{"id":38456868,"uuid":"242534559","full_name":"lichess-org/lila-gif","owner":"lichess-org","description":"Webservice to render Gifs of chess positions and games, and stream them frame by frame","archived":false,"fork":false,"pushed_at":"2025-03-13T06:46:31.000Z","size":84803,"stargazers_count":104,"open_issues_count":11,"forks_count":22,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T11:06:11.706Z","etag":null,"topics":["chess","gif","http-api","lichess"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lichess-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://lichess.org/patron"}},"created_at":"2020-02-23T14:46:17.000Z","updated_at":"2025-03-13T06:46:35.000Z","dependencies_parsed_at":"2024-12-23T10:27:30.587Z","dependency_job_id":"7ba9a5d3-5ef6-46cf-b95e-c247d6894aeb","html_url":"https://github.com/lichess-org/lila-gif","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lichess-org%2Flila-gif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lichess-org%2Flila-gif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lichess-org%2Flila-gif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lichess-org%2Flila-gif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lichess-org","download_url":"https://codeload.github.com/lichess-org/lila-gif/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332560,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chess","gif","http-api","lichess"],"created_at":"2024-11-17T19:12:37.140Z","updated_at":"2025-04-05T12:04:22.205Z","avatar_url":"https://github.com/lichess-org.png","language":"Rust","funding_links":["https://lichess.org/patron"],"categories":[],"sub_categories":[],"readme":"# lila-gif\n\nWebservice to render Gifs of chess positions and games, and stream them\nframe by frame.\n\n![Example: DrDrunkenstein vs. Zhigalko_Sergei](/example.gif)\n\n| size    | render time | frames | colors | width  | height |\n| ------- | ----------- | ------ | ------ | ------ | ------ |\n| 336 KiB | ~60 ms      | 93     | 63     | 720 px | 840 px |\n\n## Usage\n\n```\nlila-gif\n\nUSAGE:\n    lila-gif [OPTIONS]\n\nOPTIONS:\n        --bind \u003cBIND\u003e    Listen on this address [default: 127.0.0.1:6175]\n    -h, --help           Print help information\n```\n\n## HTTP API\n\n### `GET /image.gif`\n\n```\ncurl \"http://localhost:6175/image.gif?fen=4k3/6KP/8/8/8/8/7p/8\" --output image.gif\n```\n\n| name        | type  | default                                   | description                                                                                  |\n| ----------- | ----- | ----------------------------------------- | -------------------------------------------------------------------------------------------- |\n| **fen**     | ascii | _starting position_                       | FEN of the position. Board part is sufficient.                                               |\n| white       | utf-8 | _none_                                    | Name of the white player. Known chess titles are highlighted. Limited to 100 bytes.          |\n| black       | utf-8 | _none_                                    | Name of the black player. Known chess titles are highlighted. Limited to 100 bytes.          |\n| comment     | utf-8 | `https://github.com/lichess-org/lila-gif` | Comment to be added to GIF meta data. Limited to 255 bytes.                                  |\n| lastMove    | ascii | _none_                                    | Last move in UCI notation (like `e2e4`).                                                     |\n| check       | ascii | _none_                                    | Square of king in check (like `e1`).                                                         |\n| orientation |       | `white`                                   | Pass `black` to flip the board.                                                              |\n| theme       |       | `brown`                                   | Board theme. `blue`, `brown`, `green`, `ic`, `pink`, or `purple`.                            |\n| piece       |       | `cburnett`                                | Piece set from this [list](https://github.com/lichess-org/lila-gif/tree/master/theme/piece). |\n\n### `POST /game.gif`\n\n```javascript\n{\n  \"white\": \"Molinari\", // optional\n  \"black\": \"Bordais\", // optional\n  \"comment\": \"https://www.chessgames.com/perl/chessgame?gid=1251038\", // optional\n  \"orientation\": \"white\", // default\n  \"theme\": \"brown\", // default\n  \"piece\": \"cburnett\", // default\n  \"delay\": 50, // default frame delay in centiseconds\n  \"frames\": [\n    // [...]\n    {\n      \"fen\": \"r1bqkb1r/pp1ppppp/5n2/2p5/2P1P3/2Nn2P1/PP1PNP1P/R1BQKB1R w KQkq - 1 6\",\n      \"delay\": 500, // optionally overwrite default delay\n      \"lastMove\": \"b4d3\", // optionally highlight last move\n      \"check\": \"e1\" // optionally highlight king\n    }\n  ]\n}\n```\n\n### `GET /example.gif`\n\n```\ncurl http://localhost:6175/example.gif --output example.gif\n```\n\nRender an [example game](https://lichess.org/Q0iQs5Zi).\n\n## Technique\n\nInstead of rendering vector graphics at runtime, all pieces are prerendered\non every possible background. This allows preparing a minimal color palette\nahead of time. (Pieces are not just black and white, but need other colors\nfor anti-aliasing on the different background colors).\n\n![Sprite](/theme/sprites/brown-cburnett.gif)\n\nAll thats left to do at runtime, is copying sprites and Gif encoding.\nMore than 95% of the rendering time is spent in LZW compression.\n\nFor animated games, frames only contain the changed squares on transparent\nbackground. The example below is the last frame of the animation.\n\n![Example frame](/example-frame.gif)\n\n## License\n\nlila-gif is licensed under the GNU Affero General Public License, version 3 or\nany later version, at your option.\n\nThe generated images include text in\n[Noto Sans](https://fonts.google.com/specimen/Noto+Sans) (Apache License 2.0)\nand a pieces sets with\n[various licenses](https://github.com/lichess-org/lila/blob/master/COPYING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flichess-org%2Flila-gif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flichess-org%2Flila-gif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flichess-org%2Flila-gif/lists"}