{"id":18903787,"url":"https://github.com/bububa/tableimage","last_synced_at":"2025-07-31T15:34:23.739Z","repository":{"id":57696090,"uuid":"399459313","full_name":"bububa/tableimage","owner":"bububa","description":"table image generator","archived":false,"fork":false,"pushed_at":"2023-03-07T03:11:05.000Z","size":9924,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T03:46:09.238Z","etag":null,"topics":["image","renderer","rendering-engine","table"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bububa.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":"2021-08-24T12:37:36.000Z","updated_at":"2022-10-12T09:53:15.000Z","dependencies_parsed_at":"2024-06-20T01:27:02.355Z","dependency_job_id":"e2b5ddaf-d67b-4a4d-b7a6-bab60f4fc6d2","html_url":"https://github.com/bububa/tableimage","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bububa/tableimage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Ftableimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Ftableimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Ftableimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Ftableimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bububa","download_url":"https://codeload.github.com/bububa/tableimage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bububa%2Ftableimage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268065749,"owners_count":24190182,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["image","renderer","rendering-engine","table"],"created_at":"2024-11-08T09:06:27.158Z","updated_at":"2025-07-31T15:34:23.681Z","avatar_url":"https://github.com/bububa.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tableimage generator\n\nGenerates a table inside of a image based on the provided data\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/bububa/tableimage.svg)](https://pkg.go.dev/github.com/bububa/tableimage)\n[![Go](https://github.com/bububa/tableimage/actions/workflows/go.yml/badge.svg)](https://github.com/bububa/tableimage/actions/workflows/go.yml)\n[![goreleaser](https://github.com/bububa/tableimage/actions/workflows/goreleaser.yml/badge.svg)](https://github.com/bububa/tableimage/actions/workflows/goreleaser.yml)\n[![GitHub go.mod Go version of a Go module](https://img.shields.io/github/go-mod/go-version/bububa/tableimage.svg)](https://github.com/bububa/tableimage)\n[![GoReportCard](https://goreportcard.com/badge/github.com/bububa/tableimage)](https://goreportcard.com/report/github.com/bububa/tableimage)\n[![GitHub license](https://img.shields.io/github/license/bububa/tableimage.svg)](https://github.com/bububa/tableimage/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/bububa/tableimage.svg)](https://GitHub.com/bububa/tableimage/releases/)\n\n### Features\n\n- support border, font, color, padding, margin etc. style settings\n- style inherit, could set style in cell, row, table level\n- support image in table\n- support text dpi setting, font size setting based on 72dpi\n- support inline text style (inline text format \u003ctext color=\"#0f0\" bgcolor=\"#FFF\" padding=\"2\"\u003estyled text\u003c/text\u003e.)\n\n### Example:\n\n![Example](examples/test.png \"Example\")\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"image\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/bububa/tableimage\"\n\t\"github.com/llgcode/draw2d\"\n)\n\nfunc main() {\n\timageURL := \"https://images.pexels.com/photos/906052/pexels-photo-906052.jpeg?auto=compress\u0026cs=tinysrgb\u0026dpr=2\u0026h=750\u0026w=200\"\n\n\tti, err := tableimage.New(\n\t\ttableimage.WithBgColor(\"#FFFFFF\"),\n\t\ttableimage.WithBorderColor(\"#0277BD\"),\n\t\ttableimage.WithFontSize(11),\n\t\ttableimage.WithDPI(144),\n\t\ttableimage.WithFontData(\u0026draw2d.FontData{\n\t\t\tName:   \"NotoSansCJKsc\",\n\t\t\tFamily: draw2d.FontFamilySans,\n\t\t\tStyle:  draw2d.FontStyleNormal,\n\t\t}),\n\t\ttableimage.WithFontFolder(\"./font\"),\n\t)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn\n\t}\n\n\theaderFont := \u0026tableimage.Font{\n\t\tSize: 13,\n\t\tData: \u0026draw2d.FontData{\n\t\t\tName:   \"Roboto\",\n\t\t\tFamily: draw2d.FontFamilySans,\n\t\t\tStyle:  draw2d.FontStyleBold,\n\t\t},\n\t}\n\n\tfooterFont := \u0026tableimage.Font{\n\t\tSize: 10,\n\t\tData: \u0026draw2d.FontData{\n\t\t\tName:   \"NotoSansCJKsc\",\n\t\t\tFamily: draw2d.FontFamilySans,\n\t\t\tStyle:  draw2d.FontStyleNormal,\n\t\t},\n\t}\n\n\theaderStyle := \u0026tableimage.Style{\n\t\tFont: headerFont,\n\t}\n\n\tcaption := \u0026tableimage.Cell{\n\t\tText: \"this is a caption very long long long ago adsfasdfwe;alsdkfasdfasf asdfajsdf\",\n\t\tStyle: \u0026tableimage.Style{\n\t\t\tColor: \"#3F51B5\",\n\t\t\tFont:  headerFont,\n\t\t},\n\t}\n\n\ttfooter := \u0026tableimage.Cell{\n\t\tText: \"this is a tabel footer very long long long ago adsfasdfwe;alsdkfasdfasf asdfajsdf\",\n\t\tStyle: \u0026tableimage.Style{\n\t\t\tColor: \"#D7CCC8\",\n\t\t\tFont:  footerFont,\n\t\t},\n\t}\n\n\trows := []tableimage.Row{\n\t\t{\n\t\t\tStyle: headerStyle,\n\t\t\tCells: []tableimage.Cell{\n\t\t\t\t{\n\t\t\t\t\tText: \"Id\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tText: \"Name\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor: \"#008000\",\n\t\t\t\t\t},\n\t\t\t\t\tText: \"Price\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCells: []tableimage.Cell{\n\t\t\t\t{\n\t\t\t\t\tText: \"2223\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:    \"#000\",\n\t\t\t\t\t\tMaxWidth: 100,\n\t\t\t\t\t\tAlign:    tableimage.CENTER,\n\t\t\t\t\t},\n\t\t\t\t\tText: \"这是一个真正的table图片\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor: \"#0000ff\",\n\t\t\t\t\t},\n\t\t\t\t\tText: \"2000$\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCells: []tableimage.Cell{\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:  \"#6A1B9A\",\n\t\t\t\t\t\tVAlign: tableimage.TOP,\n\t\t\t\t\t},\n\t\t\t\t\tText: \"11\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:    \"#FFF\",\n\t\t\t\t\t\tMaxWidth: 100,\n\t\t\t\t\t\tBgColor:  \"#D32F2F\",\n\t\t\t\t\t},\n                    IgnoreInlineStyle: false,\n\t\t\t\t\tText: \"A more \u003ctext bgcolor='#8BC34A' color='#000' padding='4'\u003ecooler product this\u003c/text\u003e time on 3 lines\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:  \"#0000ff\",\n\t\t\t\t\t\tAlign:  tableimage.RIGHT,\n\t\t\t\t\t\tVAlign: tableimage.BOTTOM,\n\t\t\t\t\t},\n\t\t\t\t\tText: \"200$\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCells: []tableimage.Cell{\n\t\t\t\t{\n\t\t\t\t\tText: \"2223\",\n\t\t\t\t\tImage: \u0026tableimage.Image{\n\t\t\t\t\t\tURL:     imageURL,\n\t\t\t\t\t\tSize:    image.Pt(80, 0),\n\t\t\t\t\t\tVAlign:  tableimage.BOTTOM,\n\t\t\t\t\t\tPadding: tableimage.NewPaddingY(4),\n\t\t\t\t\t},\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tAlign: tableimage.RIGHT,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:    \"#000\",\n\t\t\t\t\t\tMaxWidth: 100,\n\t\t\t\t\t\tAlign:    tableimage.CENTER,\n\t\t\t\t\t},\n\t\t\t\t\tImage: \u0026tableimage.Image{\n\t\t\t\t\t\tURL:     imageURL,\n\t\t\t\t\t\tSize:    image.Pt(80, 0),\n\t\t\t\t\t\tVAlign:  tableimage.TOP,\n\t\t\t\t\t\tPadding: tableimage.NewPaddingY(4),\n\t\t\t\t\t},\n\t\t\t\t\tText: \"这是一个真正的table图片\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor: \"#0000ff\",\n\t\t\t\t\t},\n\t\t\t\t\tText: \"2000$\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tCells: []tableimage.Cell{\n\t\t\t\t{\n\t\t\t\t\tText: \"2223\",\n\t\t\t\t\tImage: \u0026tableimage.Image{\n\t\t\t\t\t\tURL:     imageURL,\n\t\t\t\t\t\tSize:    image.Pt(80, 0),\n\t\t\t\t\t\tAlign:   tableimage.LEFT,\n\t\t\t\t\t\tPadding: tableimage.NewPaddingX(4),\n\t\t\t\t\t},\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tVAlign: tableimage.BOTTOM,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor:    \"#000\",\n\t\t\t\t\t\tMaxWidth: 150,\n\t\t\t\t\t\tAlign:    tableimage.RIGHT,\n\t\t\t\t\t\tVAlign:   tableimage.MIDDLE,\n\t\t\t\t\t},\n\t\t\t\t\tImage: \u0026tableimage.Image{\n\t\t\t\t\t\tURL:     imageURL,\n\t\t\t\t\t\tSize:    image.Pt(80, 0),\n\t\t\t\t\t\tAlign:   tableimage.RIGHT,\n\t\t\t\t\t\tPadding: tableimage.NewPaddingX(4),\n\t\t\t\t\t},\n\t\t\t\t\tText: \"这是一个真正的table图片\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tStyle: \u0026tableimage.Style{\n\t\t\t\t\t\tColor: \"#0000ff\",\n\t\t\t\t\t},\n\t\t\t\t\tText: \"2000$\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\timg, err := ti.Draw(rows, caption, tfooter)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn\n\t}\n\tf, err := os.Create(\"./test.png\")\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\ttableimage.Write(f, img, tableimage.PNG)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbububa%2Ftableimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbububa%2Ftableimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbububa%2Ftableimage/lists"}