{"id":13463220,"url":"https://github.com/whomwah/rqrcode","last_synced_at":"2026-01-08T21:13:57.604Z","repository":{"id":388956,"uuid":"6485","full_name":"whomwah/rqrcode","owner":"whomwah","description":"A Ruby library that encodes QR Codes","archived":false,"fork":false,"pushed_at":"2025-11-25T15:42:13.000Z","size":551,"stargazers_count":1961,"open_issues_count":0,"forks_count":239,"subscribers_count":27,"default_branch":"main","last_synced_at":"2025-12-29T10:50:21.302Z","etag":null,"topics":["qrcode","qrcode-generator","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/whomwah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"whomwah","buy_me_a_coffee":"duncanrobertson"}},"created_at":"2008-04-03T09:31:15.000Z","updated_at":"2025-12-23T15:23:48.000Z","dependencies_parsed_at":"2023-07-05T14:45:44.642Z","dependency_job_id":"6fdb30b8-4bc8-4598-b18b-ec613649f751","html_url":"https://github.com/whomwah/rqrcode","commit_stats":{"total_commits":273,"total_committers":46,"mean_commits":5.934782608695652,"dds":0.7692307692307692,"last_synced_commit":"e4a5bf2320afdad5906bd33f3af3c73ad7231151"},"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/whomwah/rqrcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whomwah","download_url":"https://codeload.github.com/whomwah/rqrcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whomwah%2Frqrcode/sbom","scorecard":{"id":1240310,"data":{"date":"2025-12-01","repo":{"name":"github.com/whomwah/rqrcode","commit":"e789be339b6f833a01bc4c84e3d444e4699c3765"},"scorecard":{"version":"v5.4.1-0.20251125161513-488797dbe611","commit":"488797dbe611ab7e16f12d88185cde5e8dc28aca"},"score":4.4,"checks":[{"name":"Maintained","score":5,"reason":"5 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ruby.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 2/13 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ruby.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/whomwah/rqrcode/ruby.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ruby.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/whomwah/rqrcode/ruby.yml/main?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/488797dbe611ab7e16f12d88185cde5e8dc28aca/docs/checks.md#sast"}}]},"last_synced_at":"2025-12-09T04:56:52.165Z","repository_id":388956,"created_at":"2025-12-09T04:56:52.166Z","updated_at":"2025-12-09T04:56:52.166Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28129967,"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-12-30T02:00:05.476Z","response_time":64,"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":["qrcode","qrcode-generator","ruby"],"created_at":"2024-07-31T13:00:48.356Z","updated_at":"2026-01-08T21:13:57.572Z","avatar_url":"https://github.com/whomwah.png","language":"Ruby","readme":"# RQRCode\n\n![](https://github.com/whomwah/rqrcode/actions/workflows/ruby.yml/badge.svg)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)\n\n[RQRCode](https://github.com/whomwah/rqrcode) is a library for creating and rendering QR codes into various formats. It has a simple interface with all the standard QR code options. It was adapted from the Javascript library by Kazuhiko Arase.\n\n- QR code is trademarked by Denso Wave inc\n- Minimum Ruby version is `\u003e= 3.0.0`\n\n## Installing\n\nAdd this line to your application's `Gemfile`:\n\n```ruby\ngem \"rqrcode\", \"~\u003e 3.0\"\n```\n\nor install manually:\n\n```ruby\ngem install rqrcode\n```\n\n## Basic usage example\n\n```ruby\nrequire \"rqrcode\"\n\nqr = RQRCode::QRCode.new(\"https://kyan.com\")\n\nputs qr.to_s\n# to_s( dark: \"x\", light: \" \" ) # defaults\n\nxxxxxxx xxxxxxx  xxx  xxxxxxx\nx     x  x  xxx   xx  x     x\nx xxx x xx x x     xx x xxx x\nx xxx x      xx xx xx x xxx x\nx xxx x x x       xxx x xxx x\nx     x  xxx x xx x x x     x\n...\n```\n\nEasy, but unlikely to be readable. For this you will need to use one of the many [rendering options](#render-types) below.\n\n### Advanced Options\n\nThese are the various QR code generation options provided by the underlying [rqrcode_core](https://github.com/whomwah/rqrcode_core). You may actually only need this library if you don't need the various rendering options `rqrcode` provides, but just need the data structure.\n\n```\nExpects a string or array (for multi-segment encoding) to be parsed in, other args are optional\n\n  data - the string, QRSegment or array of Hashes (with data:, mode: keys) you wish to encode\n\n  size - the size (Integer) of the QR Code (defaults to smallest size needed to encode the data)\n\n  max_size - the max_size (Integer) of the QR Code (default RQRCodeCore::QRUtil.max_size)\n\n  level - the error correction level, can be:\n    * Level :l 7%  of code can be restored\n    * Level :m 15% of code can be restored\n    * Level :q 25% of code can be restored\n    * Level :h 30% of code can be restored (default :h)\n\n  mode - the mode of the QR Code (defaults to :alphanumeric or :byte_8bit, depending on the input data,\n         only used when data is a string):\n    * :number\n    * :alphanumeric\n    * :byte_8bit\n```\n\nExample\n\n```ruby\nsimple_qrcode = RQRCodeCore::QRCode.new(\"https://kyan.com\", size: 2, level: :m, mode: :byte_8bit)\n\nsegment_qrcode = RQRCodeCore::QRCode.new([{ data: \"foo\", mode: :byte_8bit }])\n\nmulti_qrcode = RQRCodeCore::QRCode.new([\n  { data: 'foo', mode: :byte_8bit },\n  { data: 'BAR1', mode: :alphanumeric }\n])\n```\n\n## Render types\n\nYou probably want to output your QR code in a specific format. We make this easy by providing a bunch of formats to choose from below, each with their own set of options:\n\n### `as_svg`\n\nThe SVG renderer will produce a stand-alone SVG as a `String`\n\n```\nOptions:\n\noffset          - Padding around the QR Code in pixels\n                  (default 0)\noffset_x        - X Padding around the QR Code in pixels\n                  (default offset)\noffset_y        - Y Padding around the QR Code in pixels\n                  (default offset)\nfill            - Background color e.g \"ffffff\" or :white or :currentColor\n                  (default none)\ncolor           - Foreground color e.g \"000\" or :black or :currentColor\n                  (default \"000\")\nmodule_size     - The Pixel size of each module\n                  (defaults 11)\nshape_rendering - SVG Attribute: auto | optimizeSpeed | crispEdges | geometricPrecision\n                  (defaults crispEdges)\nstandalone      - Whether to make this a full SVG file, or only an svg to embed in other svg\n                  (default true)\nuse_path        - Use \u003cpath\u003e to render SVG rather than \u003crect\u003e to significantly reduce size.\n                  This will become the default in future versions.\n                  (default false)\nviewbox         - Replace the `svg.width` and `svg.height` attribute with `svg.viewBox` to\n                  allow CSS scaling\n                  (default false)\nsvg_attributes  - A optional hash of custom \u003csvg\u003e attributes. Existing attributes will remain.\n                  (default {})\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http://github.com/\")\n\n# NOTE: showing with default options specified explicitly\nsvg = qrcode.as_svg(\n  color: \"000\",\n  shape_rendering: \"crispEdges\",\n  module_size: 11,\n  standalone: true,\n  use_path: true\n)\n```\n\n![QR code with github url](./images/github-qrcode.svg)\n\n### `as_png`\n\nThe will produce a PNG using the [ChunkyPNG gem](https://github.com/wvanbergen/chunky_png). The result will be a `ChunkyPNG::Image` instance.\n\n```\nOptions:\n\nfill  - Background \u003cChunkyPNG::Color\u003e, defaults to 'white'. Use [] for multi args\ncolor - Foreground \u003cChunkyPNG::Color\u003e, defaults to 'black'. Use [] for multi args\n\nWhen option :file is supplied you can use the following ChunkyPNG constraints:\n\ncolor_mode  - The color mode to use. Use one of the ChunkyPNG::COLOR_* constants.\n              (defaults to 'ChunkyPNG::COLOR_GRAYSCALE')\nbit_depth   - The bit depth to use. This option is only used for indexed images.\n              (defaults to 1 bit)\ninterlace   - Whether to use interlacing (true or false).\n              (defaults to ChunkyPNG default)\ncompression - The compression level for Zlib. This can be a value between 0 and 9, or a\n              Zlib constant like Zlib::BEST_COMPRESSION\n              (defaults to ChunkyPNG default)\n\nThere are two sizing algorithms.\n\n* Original that can result in blurry and hard to scan images\n* Google's Chart API inspired sizing that resizes the module size to fit within the given image size.\n\nThe Google one will be used when no options are given or when the new size option is used.\n\n*Google Sizing*\n\nsize            - Total size of PNG in pixels. The module size is calculated so it fits.\n                  (defaults to 120)\nborder_modules  - Width of white border around the modules.\n                  (defaults to 4).\n\n-- DONT USE border_modules OPTION UNLESS YOU KNOW ABOUT THE QUIET ZONE NEEDS OF QR CODES --\n\n*Original Sizing*\n\nmodule_px_size  - Image size, in pixels.\nborder          - Border thickness, in pixels\n\nIt first creates an image where 1px = 1 module, then resizes.\nDefaults to 120x120 pixels, customizable by option.\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http://github.com/\")\n\n# NOTE: showing with default options specified explicitly\npng = qrcode.as_png(\n  bit_depth: 1,\n  border_modules: 4,\n  color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n  color: \"black\",\n  file: nil,\n  fill: \"white\",\n  module_px_size: 6,\n  resize_exactly_to: false,\n  resize_gte_to: false,\n  size: 120\n)\n\nIO.binwrite(\"/tmp/github-qrcode.png\", png.to_s)\n```\n\n![QR code with github url](./images/github-qrcode.png)\n\n### `as_ansi`\n\nThe ANSI renderer will produce as a string with ANSI color codes.\n\n```\nOptions:\n\nlight           - Foreground ANSI code\n                  (default \"\\033[47m\")\ndark            - Background ANSI code\n                  (default \"\\033[40m\")\nfill_character  - The written character\n                  (default '  ')\nquiet_zone_size - Padding around the edge\n                  (default 4)\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http://github.com/\")\n\n# NOTE: showing with default options specified explicitly\nsvg = qrcode.as_ansi(\n  light: \"\\033[47m\", dark: \"\\033[40m\",\n  fill_character: \"  \",\n  quiet_zone_size: 4\n)\n```\n\n![QR code with github url](./images/ansi-screen-shot.png)\n\n## API Documentation\n\n[http://www.rubydoc.info/gems/rqrcode](http://www.rubydoc.info/gems/rqrcode)\n\n## Tests\n\nYou can run the test suite using:\n\n```\n$ bundle install\n$ rake      # runs specs and standard:fix\n$ rake spec # just runs the specs\n```\n\nor try the lib from the console with:\n\n```\n$ ./bin/console\n```\n\n## Linting\n\nThe project uses [standardrb](https://github.com/testdouble/standard) and can be used with:\n\n```\n$ bundle install\n$ rake standard # checks\n$ rake standard:fix # fixes\n```\n\n## Contributing\n\nI am not currently accepting any new renderers as the current `as_png`, `as_svg` and `as_ansi` work for most cases. If you need something different from what's available, the [`rqrcode_core`](https://github.com/whomwah/rqrcode_core) gem gives you access to all the QR Code information you will need so makes it simple to generate your own.\n\nThe motivation for the above is because the rendering side of this gem takes up the most time. It seems that many people want a slightly different version of a QR Code so supporting all the variations would be hard. The easiest way is to empower people to create their own versions which they can manage and share. This is what `rqrcode_core` does.\n\nAny contribution PR's will be greatly accepted. It's important that they are well tested and backwards compatible.\n\n- Fork the project\n- Send a pull request\n- Don't touch the .gemspec, I'll do that when I release a new version\n\nThanks D.\n\n## Authors\n\nOriginal RQRCode author: Duncan Robertson\n\nA massive thanks to [all the contributors of the library over the years](https://github.com/whomwah/rqrcode/graphs/contributors). It wouldn't exist if it wasn't for you all.\n\nOh, and thanks to my bosses at https://kyan.com for giving me time to maintain this project.\n\n## Resources\n\n- wikipedia:: http://en.wikipedia.org/wiki/QR_Code\n- Denso-Wave website:: http://www.denso-wave.com/qrcode/index-e.html\n- kaywa:: http://qrcode.kaywa.com\n\n## Copyright\n\nMIT License (http://www.opensource.org/licenses/mit-license.html)\n","funding_links":["https://github.com/sponsors/whomwah","https://buymeacoffee.com/duncanrobertson"],"categories":["Graphics","Ruby","QR","QR Codes","Libraries"],"sub_categories":["QR Codes","Ruby"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhomwah%2Frqrcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhomwah%2Frqrcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhomwah%2Frqrcode/lists"}