{"id":21316104,"url":"https://github.com/cjsaylor/chessimage","last_synced_at":"2025-07-12T01:31:38.629Z","repository":{"id":138151611,"uuid":"143792035","full_name":"cjsaylor/chessimage","owner":"cjsaylor","description":"Golang library for rendering chess board images in a specific state.","archived":false,"fork":false,"pushed_at":"2024-05-29T17:22:17.000Z","size":343,"stargazers_count":5,"open_issues_count":5,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T12:22:37.125Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/cjsaylor/chessimage","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjsaylor.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}},"created_at":"2018-08-06T22:59:24.000Z","updated_at":"2024-05-29T17:22:21.000Z","dependencies_parsed_at":"2024-05-29T20:06:00.217Z","dependency_job_id":"8031dea0-d4c6-42fa-b30e-78467300b2f2","html_url":"https://github.com/cjsaylor/chessimage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cjsaylor/chessimage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjsaylor","download_url":"https://codeload.github.com/cjsaylor/chessimage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjsaylor%2Fchessimage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923080,"owners_count":23683716,"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":[],"created_at":"2024-11-21T18:29:43.656Z","updated_at":"2025-07-12T01:31:38.109Z","avatar_url":"https://github.com/cjsaylor.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chessimage\n\n`chessimage` is a [golang](https://golang.org) library for rendering a chess board PNG in specific state.\n\n[![GoDoc](https://godoc.org/github.com/cjsaylor/chessimage?status.svg)](https://godoc.org/github.com/cjsaylor/chessimage)\n\n![](./docs/starting_board.png)\n\n\u003e `go run examples/starting_board.go | open -f -a /Applications/Preview.app/`\n\n## Basic Usage\n\nInclude in your go path.\n\n```bash\ngo get github.com/cjsaylor/chessimage\n```\n\nInitialize the renderer with a FEN notation.\n\n```go\nboard, _ := chessimage.NewRendererFromFEN(\"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\")\n```\n\nRender the chess board to a png `image.Image` interface.\n\n```go\nf, _ := os.Create(\"board.png\")\ndefer f.Close()\nimage, _ := board.Render(chessimage.Options{AssetPath: \"./assets/\"})\npng.Encode(f, image)\n```\n\n## Highlighting LastMove\n\nYou can highlight tiles of where a move started and ended.\n\n```go\nboard.SetLastMove(chessimage.LastMove{\n\tFrom: chessimage.E4,\n\tTo: chessimage.E2,\n})\n```\n\n[Example](./blob/master/examples/board_with_moves.go)\n\n![](./docs/board_with_moves.png)\n\n## Mark Checked\n\nYou can highlight a tile as \"checked\".\n\n```go\nboard.SetCheckTile(chessimage.G1)\n```\n\n[Example](./blob/master/examples/king_checked.go)\n\n![](./docs/king_checked.png)\n\n## Options\n\nYou can define rendering options at render time:\n\n```go\noptions := chessimage.Options{\n\tAssetPath: \"./assets/\"\n}\nrenderer.Render(options)\n```\n\n#### AssetPath (**Required**)\n\nSpecify the path of the image assets for the individual pieces. Feel free to use the assets packaged in this repo, but be aware they are under CC license.\n\n#### Inverted (`false`)\n\nInvert the board so that it displays correctly for the black player. By default the white player view is rendered. This is a boolean option.\n\n#### Resizer (`draw.CatmullRom`)\n\nChange the algorhythm for asset resizing. Depending on your performance requirements, you may need to use a faster (but more lossy) resizing method (like `draw.NearestNeighbor`).\n\n#### BoardSize (`512`)\n\nSquare board size in pixels\n\n#### PieceRatio (`0.8`)\n\nSize of the pieces relative as a percentage to the game board tile size. If the game board size is `800`, each board tile would be `100` pixels wide, and the pieces would render at `80` pixels with the default ratio.\n\n## Todo\n\n* Add support for `PGN` notation for rendering a board (similar to the `FEN` notation setup now)\n* Add configuration support for changing board and tile highlight colors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjsaylor%2Fchessimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjsaylor%2Fchessimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjsaylor%2Fchessimage/lists"}