{"id":13723333,"url":"https://github.com/yeqown/go-qrcode","last_synced_at":"2025-05-14T13:06:35.298Z","repository":{"id":37431343,"uuid":"158911313","full_name":"yeqown/go-qrcode","owner":"yeqown","description":"To help gophers generate QR Codes with customized styles, such as color, block size, block shape, and icon.","archived":false,"fork":false,"pushed_at":"2025-04-29T00:27:52.000Z","size":929,"stargazers_count":673,"open_issues_count":6,"forks_count":97,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-29T01:34:31.222Z","etag":null,"topics":["adjustable","cli","colorful","golang","halftone-qr-code","highly-customizable","library","qrcode","wasm"],"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/yeqown.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,"zenodo":null}},"created_at":"2018-11-24T07:04:01.000Z","updated_at":"2025-04-29T00:27:57.000Z","dependencies_parsed_at":"2024-04-03T07:28:06.351Z","dependency_job_id":"fa4cd374-99ce-47b6-b44c-fba1ad69e0d0","html_url":"https://github.com/yeqown/go-qrcode","commit_stats":{"total_commits":156,"total_committers":20,"mean_commits":7.8,"dds":"0.21153846153846156","last_synced_commit":"4bcbcb57ae9a591876775e2f6e54e0c7f912bc2f"},"previous_names":[],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fgo-qrcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fgo-qrcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fgo-qrcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yeqown%2Fgo-qrcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yeqown","download_url":"https://codeload.github.com/yeqown/go-qrcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149953,"owners_count":22022851,"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":["adjustable","cli","colorful","golang","halftone-qr-code","highly-customizable","library","qrcode","wasm"],"created_at":"2024-08-03T01:01:39.397Z","updated_at":"2025-05-14T13:06:30.284Z","avatar_url":"https://github.com/yeqown.png","language":"Go","funding_links":[],"categories":["Images","Go","Recently Updated","图片处理库","图片"],"sub_categories":["Search and Analytic Databases","[Oct 26, 2024](/content/2024/10/26/README.md)","交互工具","检索及分析资料库"],"readme":"# go-qrcode #\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/yeqown/go-qrcode)](https://goreportcard.com/report/github.com/yeqown/go-qrcode) \n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/yeqown/go-qrcode/v2)\n[![Go](https://github.com/yeqown/go-qrcode/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/yeqown/go-qrcode/actions/workflows/go.yml) ![](https://changkun.de/urlstat?mode=github\u0026repo=yeqown/go-qrcode)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/yeqown/go-qrcode)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/yeqown/go-qrcode)\n[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)\n\n\u003cimg src=\"./assets/repository_qrcode.png\" width=\"100px\" align=\"right\"/\u003e\nQR code (abbreviated from Quick Response Code) is the trademark for a type of matrix barcode (or two-dimensional barcode) first designed in 1994 for the automotive industry in Japan. A barcode is a machine-readable optical label that contains information about the item to which it is attached. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently; extensions may also be used\n\n### Features\n\n- [x] Normally generate QR code across `version 1` to `version 40`.\n- [x] Automatically analyze QR version by source text.\n- [x] Specifying cell shape allowably with `WithCustomShape`, `WithCircleShape` (default is `rectangle`)\n- [x] Specifying output file's format with `WithBuiltinImageEncoder`, `WithCustomImageEncoder` (default is `JPEG`)\n- [x] Not only shape of cell, but also color of QR Code background and foreground color.\n- [x] `WithLogoImage`, `WithLogoImageFilePNG`, `WithLogoImageFileJPEG` help you add an icon at the central of QR Code.\n- [x] `WithBorderWidth` allows to specify any width of 4 sides around the qrcode.\n- [x] `WebAssembly` support, check out the [Example](./example/webassembly/README.md) and [README](cmd/wasm/README.md) for more detail.\n- [x] support Halftone QR Codes, check out the [Example](./example/with-halftone).\n### Install\n\n```sh\ngo get -u github.com/yeqown/go-qrcode/v2\n```\n\n### Quick Start\n\nlink to [CODE](./example/main.go)\n```go\npackage main\n\nimport (\n\t\"github.com/yeqown/go-qrcode/v2\"\n\t\"github.com/yeqown/go-qrcode/writer/standard\"\n)\n\nfunc main() {\n\tqrc, err := qrcode.New(\"https://github.com/yeqown/go-qrcode\")\n\tif err != nil {\n\t\tfmt.Printf(\"could not generate QRCode: %v\", err)\n\t\treturn\n\t}\n\t\n\tw, err := standard.New(\"../assets/repo-qrcode.jpeg\")\n\tif err != nil {\n\t\tfmt.Printf(\"standard.New failed: %v\", err)\n\t\treturn\n\t}\n\t\n\t// save file\n\tif err = qrc.Save(w); err != nil {\n\t\tfmt.Printf(\"could not save image: %v\", err)\n\t}\n}\n```\n\n### Options\n\n```go\nconst (\n\t// EncModeNone mode ...\n\tEncModeNone encMode = 1 \u003c\u003c iota\n\t// EncModeNumeric mode ...\n\tEncModeNumeric\n\t// EncModeAlphanumeric mode ...\n\tEncModeAlphanumeric\n\t// EncModeByte mode ...\n\tEncModeByte\n\t// EncModeJP mode ...\n\tEncModeJP\n)\n\n// WithEncodingMode sets the encoding mode.\nfunc WithEncodingMode(mode encMode) EncodeOption {}\n\nconst (\n\t// ErrorCorrectionLow :Level L: 7% error recovery.\n\tErrorCorrectionLow ecLevel = iota + 1\n\t\n\t// ErrorCorrectionMedium :Level M: 15% error recovery. Good default choice.\n\tErrorCorrectionMedium\n\t\n\t// ErrorCorrectionQuart :Level Q: 25% error recovery.\n\tErrorCorrectionQuart\n\t\n\t// ErrorCorrectionHighest :Level H: 30% error recovery.\n\tErrorCorrectionHighest\n)\n\n// WithErrorCorrectionLevel sets the error correction level.\nfunc WithErrorCorrectionLevel(ecLevel ecLevel) EncodeOption {}\n```\n\nfollowing are some shots:\n\n\u003cdiv\u003e\n\u003cimg src=\"./assets/example_fg_bg.jpeg\" width=\"160px\" align=\"left\" title=\"with bg-fg color\"\u003e\n\u003cimg src=\"./assets/example_logo.jpeg\" width=\"160px\" align=\"left\" title=\"with logo image\"\u003e\n\u003cimg src=\"./assets/example_circle.jpeg\" width=\"160px\" align=\"left\" title=\"customize block shape\"\u003e\n\u003cimg src=\"./assets/example_transparent.png\" width=\"160px\" title=\"with transparent bg\"\u003e\n\u003c/div\u003e\n\n\u003cdiv\u003e\n\u003cimg src=\"./assets/example_halftone0.jpeg\" width=\"160px\" align=\"left\" title=\"halftone0\"\u003e\n\u003cimg src=\"./assets/example_halftone1.jpeg\" width=\"160px\" align=\"left\" title=\"halftone1\"\u003e\n\u003cimg src=\"./assets/example_halftone2.png\" width=\"160px\" align=\"left\" title=\"halftone2\"\u003e\n\u003cimg src=\"./assets/example_halftone3.jpeg\" width=\"160px\" title=\"halftone3\"\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n### Built-in Writers\n\n- [Standard Writer](./writer/standard/README.md), prints QRCode into file and stream\n- [Terminal Writer](./writer/terminal/README.md), prints QRCode into terminal\n- [File Writer](./writer/file/README.md), prints QRCode into files\n- [Compressed Writer](./writer/compressed/README.md), It's generated on a very small scale\n\nOf course, you can also code your own writer, just implement [Writer](./writer/README.md) interface.\n\n### Migrating from v1\n\n`go-qrcode.v2` is a major upgrade from v1, and it is not backward compatible. `v2` redesigned\nthe API, and it is more flexible and powerful. Features are split into different modules (according to functionality).\n\n- github.com/yeqown/go-qrcode/v2 **_core_** \n- github.com/yeqown/go-qrcode/writer/standard **_writer/imageFile_**\n- github.com/yeqown/go-qrcode/writer/terminal **_writer/terminal_**\n\nCheck [example/migrating-from-v1](./example/migrating-from-v1/main.go) for more details.\n\n### Links\n\n* [QRCode Tourist](https://www.thonky.com/qr-code-tutorial/)\n* [QRCode Wiki](https://en.wikipedia.org/wiki/QR_code)\n* [二维码详解 (QRCode analysis in CN-zh)](https://zhuanlan.zhihu.com/p/21463650)\n* [数据编码 (How to encode data payload in QRCode in CN-zh)](https://zhuanlan.zhihu.com/p/25432676)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeqown%2Fgo-qrcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyeqown%2Fgo-qrcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyeqown%2Fgo-qrcode/lists"}