{"id":13413197,"url":"https://github.com/shomali11/gridder","last_synced_at":"2025-04-28T16:10:15.620Z","repository":{"id":41522520,"uuid":"254505315","full_name":"shomali11/gridder","owner":"shomali11","description":"A Grid based 2D Graphics library","archived":false,"fork":false,"pushed_at":"2021-09-30T17:31:42.000Z","size":486,"stargazers_count":79,"open_issues_count":0,"forks_count":14,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-13T03:49:07.601Z","etag":null,"topics":["2d","2d-graphics","draw","graphics","grid","gridder","paint"],"latest_commit_sha":null,"homepage":"","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/shomali11.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}},"created_at":"2020-04-10T00:13:10.000Z","updated_at":"2025-04-01T19:14:15.000Z","dependencies_parsed_at":"2022-09-14T05:40:31.912Z","dependency_job_id":null,"html_url":"https://github.com/shomali11/gridder","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/shomali11%2Fgridder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shomali11%2Fgridder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shomali11%2Fgridder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shomali11%2Fgridder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shomali11","download_url":"https://codeload.github.com/shomali11/gridder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342724,"owners_count":21574245,"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":["2d","2d-graphics","draw","graphics","grid","gridder","paint"],"created_at":"2024-07-30T20:01:34.951Z","updated_at":"2025-04-28T16:10:15.590Z","avatar_url":"https://github.com/shomali11.png","language":"Go","funding_links":[],"categories":["Images","Images 图像处理","图片","Relational Databases"],"sub_categories":["Search and Analytic Databases","SQL 查询语句构建库","检索及分析资料库","Advanced Console UIs"],"readme":"# gridder [![Build Status](https://travis-ci.com/shomali11/gridder.svg?branch=master)](https://travis-ci.com/shomali11/gridder) [![Go Report Card](https://goreportcard.com/badge/github.com/shomali11/gridder)](https://goreportcard.com/report/github.com/shomali11/gridder) [![GoDoc](https://godoc.org/github.com/shomali11/gridder?status.svg)](https://godoc.org/github.com/shomali11/gridder) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nBuilt on top of Go Graphics [github.com/fogleman/gg](https://github.com/fogleman/gg) with the idea to simplify visualizing Grids using 2D Graphics.\n\n## Dependencies\n\n- `gg` [github.com/fogleman/gg](https://github.com/fogleman/gg)\n\n# Install\n\n```\ngo get github.com/shomali11/gridder\n```\n\n# Examples\n\n## Example 1\n\nExploring the `GridConfig` configuration object. The `Rows` and `Columns` represent the rows and columns of the grid you wish to visualize. You can customize the grid by playing various options from style, color and width.\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{Name: \"example1.png\"}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           8,\n\t\tMarginWidth:       0,\n\t\tLineDashes:        0,\n\t\tLineStrokeWidth:   2,\n\t\tBorderDashes:      0,\n\t\tBorderStrokeWidth: 10,\n\t\tLineColor:         color.Gray{},\n\t\tBorderColor:       color.RGBA{B: 255, A: 255},\n\t\tBackgroundColor:   color.White,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example1/example1.png)\n\n\n## Example 2\n\nExploring the `ImageConfig` configuration object. This defines the image that will be generated. You can customize the `Width` and `Height` to generate larger images.\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example2.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tMarginWidth:       20,\n\t\tLineDashes:        10,\n\t\tLineStrokeWidth:   2,\n\t\tBorderDashes:      20,\n\t\tBorderStrokeWidth: 4,\n\t\tLineColor:         color.RGBA{R: 255 / 2, A: 255},\n\t\tBorderColor:       color.RGBA{B: 255 / 2, A: 255},\n\t\tBackgroundColor:   color.RGBA{G: 255 / 2, A: 255},\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example2/example2.png)\n\n\n## Example 3\n\nUsing `PaintCell` to paint a cell by the grid's row and column\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example3.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.PaintCell(1, 2, color.Black)\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example3/example3.png)\n\n\n## Example 4\n\nUsing `DrawRectangle` to draw rectangles in cells with various stylistic properties\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example4.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.DrawRectangle(0, 0, gridder.RectangleConfig{Width: 60, Height: 60, Color: color.Black, Stroke: true, Rotate: 45})\n\tgrid.DrawRectangle(3, 0, gridder.RectangleConfig{Width: 60, Height: 60, Color: color.Black, Stroke: true, Rotate: 45, Dashes: 10})\n\tgrid.DrawRectangle(0, 3, gridder.RectangleConfig{Width: 60, Height: 60, Color: color.Black, Stroke: true, StrokeWidth: 25})\n\tgrid.DrawRectangle(2, 1, gridder.RectangleConfig{Width: 180, Height: 180, Color: color.RGBA{R: 255 / 2, A: 255 / 2}})\n\tgrid.DrawRectangle(3, 3, gridder.RectangleConfig{Width: 60, Height: 60, Color: color.Black, Stroke: false})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example4/example4.png)\n\n\n## Example 5\n\nUsing `DrawCircle` to draw circles in cells with various stylistic properties\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example5.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.DrawCircle(0, 0, gridder.CircleConfig{Radius: 30, Color: color.Black, Stroke: true})\n\tgrid.DrawCircle(3, 0, gridder.CircleConfig{Radius: 30, Color: color.Black, Stroke: true, Dashes: 10})\n\tgrid.DrawCircle(0, 3, gridder.CircleConfig{Radius: 30, Color: color.Black, Stroke: true, StrokeWidth: 25})\n\tgrid.DrawCircle(2, 1, gridder.CircleConfig{Radius: 90, Color: color.RGBA{R: 255 / 2, A: 255 / 2}})\n\tgrid.DrawCircle(3, 3, gridder.CircleConfig{Radius: 30, Color: color.Black, Stroke: false})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example5/example5.png)\n\n\n## Example 6\n\nUsing `DrawLine` to draw lines in cells with various stylistic properties\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example6.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tMarginWidth:       30,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.DrawLine(0, 0, gridder.LineConfig{Length: 60, Color: color.Black, Dashes: 0})\n\tgrid.DrawLine(0, 0, gridder.LineConfig{Length: 60, Color: color.Black, Dashes: 0, Rotate: 90})\n\tgrid.DrawLine(0, 3, gridder.LineConfig{Length: 60, Color: color.Black, Dashes: 0, StrokeWidth: 25})\n\tgrid.DrawLine(2, 1, gridder.LineConfig{Length: 90, Color: color.RGBA{R: 255 / 2, A: 255 / 2}, Rotate: 45})\n\tgrid.DrawLine(2, 1, gridder.LineConfig{Length: 90, Color: color.RGBA{R: 255 / 2, A: 255 / 2}, Rotate: 135})\n\tgrid.DrawLine(3, 3, gridder.LineConfig{Length: 60, Color: color.Black, Dashes: 5})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example6/example6.png)\n\n\n## Example 7\n\nUsing `DrawPath` to draw a path between two cells with various stylistic properties\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example7.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgrid.DrawPath(0, 0, 1, 1, gridder.PathConfig{Dashes: 0, StrokeWidth: 10, Color: color.Black})\n\tgrid.DrawPath(1, 1, 2, 1, gridder.PathConfig{Dashes: 5, StrokeWidth: 1, Color: color.Black})\n\tgrid.DrawPath(2, 1, 3, 1, gridder.PathConfig{Dashes: 8, StrokeWidth: 1, Color: color.Black})\n\tgrid.DrawPath(3, 1, 3, 2, gridder.PathConfig{Dashes: 0, StrokeWidth: 1, Color: color.Black})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example7/example7.png)\n\n\n## Example 8\n\nUsing `DrawString` to draw a string in a cell with various stylistic properties\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/golang/freetype/truetype\"\n\t\"github.com/shomali11/gridder\"\n\t\"golang.org/x/image/font/gofont/goregular\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example8.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           4,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfont, err := truetype.Parse(goregular.TTF)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfontFace1 := truetype.NewFace(font, \u0026truetype.Options{Size: 24})\n\tfontFace2 := truetype.NewFace(font, \u0026truetype.Options{Size: 35})\n\n\tgrid.DrawString(0, 0, \"Hello!\", fontFace1)\n\tgrid.DrawString(1, 1, \"Hello!\", fontFace1, gridder.StringConfig{Rotate: 45})\n\tgrid.DrawString(2, 2, \"Hello!\", fontFace2, gridder.StringConfig{Color: color.RGBA{B: 255 / 2, A: 255 / 2}})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example8/example8.png)\n\n\n## Example 9\n\nCombining multiple features to draw the shortest path on a grid\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/golang/freetype/truetype\"\n\t\"github.com/shomali11/gridder\"\n\t\"golang.org/x/image/font/gofont/goregular\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  2000,\n\t\tHeight: 1000,\n\t\tName:   \"example9.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              4,\n\t\tColumns:           8,\n\t\tMarginWidth:       32,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 20,\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfont, err := truetype.Parse(goregular.TTF)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfontFace := truetype.NewFace(font, \u0026truetype.Options{Size: 48})\n\n\tlineConfig := gridder.PathConfig{Dashes: 10}\n\tcircleConfig := gridder.CircleConfig{Color: color.Gray{}, Radius: 10}\n\n\tgrid.PaintCell(1, 2, color.NRGBA{R: 0, G: 0, B: 0, A: 255 / 2})\n\tgrid.DrawString(1, 2, \"Block\", fontFace)\n\n\tgrid.DrawCircle(0, 0, gridder.CircleConfig{Color: color.NRGBA{R: 255 / 2, G: 0, B: 0, A: 255 / 2}, Radius: 60})\n\tgrid.DrawPath(0, 0, 1, 1, lineConfig)\n\tgrid.DrawCircle(1, 1, circleConfig)\n\tgrid.DrawPath(1, 1, 2, 2, lineConfig)\n\tgrid.DrawCircle(2, 2, circleConfig)\n\tgrid.DrawPath(2, 2, 2, 3, lineConfig)\n\tgrid.DrawCircle(2, 3, circleConfig)\n\tgrid.DrawPath(2, 3, 2, 4, lineConfig)\n\tgrid.DrawCircle(2, 4, circleConfig)\n\tgrid.DrawPath(2, 4, 2, 5, lineConfig)\n\tgrid.DrawCircle(2, 5, circleConfig)\n\tgrid.DrawPath(2, 5, 2, 6, lineConfig)\n\tgrid.DrawCircle(2, 6, circleConfig)\n\tgrid.DrawPath(2, 6, 3, 7, lineConfig)\n\tgrid.DrawCircle(3, 7, gridder.CircleConfig{Color: color.NRGBA{R: 0, G: 255 / 2, B: 0, A: 255 / 2}, Radius: 60})\n\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example9/example9.png)\n\n\n## Example 10\n\nCombining multiple features to draw a Bingo card\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/golang/freetype/truetype\"\n\t\"github.com/shomali11/gridder\"\n\t\"golang.org/x/image/font/gofont/goregular\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  1000,\n\t\tHeight: 1200,\n\t\tName:   \"example10.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:            6,\n\t\tColumns:         5,\n\t\tMarginWidth:     32,\n\t\tLineStrokeWidth: 2,\n\t\tBackgroundColor: color.RGBA{R: 135, G: 211, B: 124, A: 255},\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfont, err := truetype.Parse(goregular.TTF)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\theaderFontFace := truetype.NewFace(font, \u0026truetype.Options{Size: 100})\n\tvalueFontFace := truetype.NewFace(font, \u0026truetype.Options{Size: 50})\n\n\theaders := []string{\"B\", \"I\", \"N\", \"G\", \"O\"}\n\tvalues := [][]string{\n\t\t{\"10\", \"22\", \"41\", \"53\", \"71\"},\n\t\t{\"66\", \"20\", \"40\", \"50\", \"2\"},\n\t\t{\"14\", \"26\", \"FREE\", \"52\", \"69\"},\n\t\t{\"15\", \"29\", \"37\", \"51\", \"65\"},\n\t\t{\"17\", \"6\", \"35\", \"55\", \"64\"},\n\t}\n\n\tcircleConfig := gridder.CircleConfig{Radius: 60, Color: color.White}\n\tfor i, header := range headers {\n\t\tgrid.DrawCircle(0, i, circleConfig)\n\t\tgrid.DrawString(0, i, header, headerFontFace)\n\t}\n\n\tfor row := range values {\n\t\tfor column := range values[0] {\n\t\t\tgrid.PaintCell(row+1, column, color.White)\n\t\t\tgrid.DrawString(row+1, column, values[row][column], valueFontFace)\n\t\t}\n\t}\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example10/example10.png)\n\n\n## Example 11\n\nCombining multiple features to draw a Tic Tac Toe game\n\n```go\npackage main\n\nimport (\n\t\"image/color\"\n\t\"log\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example11.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              3,\n\t\tColumns:           3,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t\tLineColor:         color.Gray{},\n\t\tBorderColor:       color.Gray{},\n\t\tBackgroundColor:   color.NRGBA{R: 220, G: 220, B: 220, A: 255},\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tblue := color.RGBA{B: 128, A: 255}\n\tgreen := color.RGBA{G: 128, A: 255}\n\n\tgrid.DrawCircle(0, 0, gridder.CircleConfig{Radius: 60, Color: blue, StrokeWidth: 4, Stroke: true})\n\tgrid.DrawCircle(1, 1, gridder.CircleConfig{Radius: 60, Color: blue, StrokeWidth: 4, Stroke: true})\n\tgrid.DrawCircle(2, 2, gridder.CircleConfig{Radius: 60, Color: blue, StrokeWidth: 4, Stroke: true})\n\tgrid.DrawLine(2, 0, gridder.LineConfig{Length: 120, Color: green, StrokeWidth: 4, Rotate: 45})\n\tgrid.DrawLine(2, 0, gridder.LineConfig{Length: 120, Color: green, StrokeWidth: 4, Rotate: 135})\n\tgrid.DrawLine(2, 1, gridder.LineConfig{Length: 120, Color: green, StrokeWidth: 4, Rotate: 45})\n\tgrid.DrawLine(2, 1, gridder.LineConfig{Length: 120, Color: green, StrokeWidth: 4, Rotate: 135})\n\tgrid.DrawPath(0, 0, 2, 2, gridder.PathConfig{StrokeWidth: 4, Color: color.RGBA{R: 128, A: 255}})\n\tgrid.SavePNG()\n}\n```\n\n![Result](examples/example11/example11.png)\n\n\n## Example 12\n\nExtract image as a byte array.   Useful for recording image in a store in text format as example below.\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"encoding/base64\"\n\t\"image/color\"\n\t\"log\"\n\t\"math/rand\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/shomali11/gridder\"\n)\n\nfunc main() {\n\timageConfig := gridder.ImageConfig{\n\t\tWidth:  500,\n\t\tHeight: 500,\n\t\tName:   \"example12.png\",\n\t}\n\tgridConfig := gridder.GridConfig{\n\t\tRows:              20,\n\t\tColumns:           20,\n\t\tLineStrokeWidth:   2,\n\t\tBorderStrokeWidth: 4,\n\t\tLineColor:         color.Gray{},\n\t\tBorderColor:       color.Gray{},\n\t\tBackgroundColor:   color.NRGBA{R: 220, G: 220, B: 220, A: 255},\n\t}\n\n\tgrid, err := gridder.New(imageConfig, gridConfig)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tblue := color.RGBA{B: 128, A: 255}\n\n\t// create a random chart\n\trand.Seed(time.Now().UnixNano())\n\tfor col := 0; col \u003c gridConfig.Columns; col++ {\n\t\theight := rand.Intn(gridConfig.Rows-1)\n\t\tfor topRow := 0; topRow \u003c height; topRow++ {\n\t\t\tgrid.DrawCircle(gridConfig.Rows-topRow, col, gridder.CircleConfig{Radius: 5, Color: blue, StrokeWidth: 4, Stroke: true})\n\t\t}\n\t}\n\n\t// encode image as byte string\n\tbImage := new(bytes.Buffer)\n\tgrid.EncodePNG(bImage)\n\n\t// convert to base64 string to support storing into database\n\timageString := base64.StdEncoding.EncodeToString(bImage.Bytes())\n\n\t// convert back from string and save as binary image\n\tbDecodedImage, err := base64.StdEncoding.DecodeString(imageString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = os.WriteFile(imageConfig.Name, bDecodedImage, 0644)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n![Result](examples/example12/example12.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshomali11%2Fgridder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshomali11%2Fgridder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshomali11%2Fgridder/lists"}