{"id":21130375,"url":"https://github.com/kenglxn/QRGen","last_synced_at":"2025-07-09T01:33:26.977Z","repository":{"id":40409115,"uuid":"3169041","full_name":"kenglxn/QRGen","owner":"kenglxn","description":"a simple QRCode generation api for java built on top ZXING","archived":false,"fork":false,"pushed_at":"2023-11-22T08:48:26.000Z","size":688,"stargazers_count":1499,"open_issues_count":10,"forks_count":299,"subscribers_count":72,"default_branch":"master","last_synced_at":"2025-05-28T17:00:26.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://glxn.net/2012/03/10/qrgen-a-small-wrapper-on-top-of-zxing-for-generating-qrcodes-in-java","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kenglxn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["kenglxn"]}},"created_at":"2012-01-13T06:58:29.000Z","updated_at":"2025-05-20T18:44:30.000Z","dependencies_parsed_at":"2022-07-12T18:02:00.394Z","dependency_job_id":"562c0909-bd59-4ad9-b8ce-a92455d5be03","html_url":"https://github.com/kenglxn/QRGen","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/kenglxn/QRGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenglxn%2FQRGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenglxn%2FQRGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenglxn%2FQRGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenglxn%2FQRGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenglxn","download_url":"https://codeload.github.com/kenglxn/QRGen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenglxn%2FQRGen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264375558,"owners_count":23598398,"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-20T05:32:40.270Z","updated_at":"2025-07-09T01:33:26.623Z","avatar_url":"https://github.com/kenglxn.png","language":"Java","funding_links":["https://github.com/sponsors/kenglxn"],"categories":["Libs"],"sub_categories":["\u003cA NAME=\"Component\"\u003e\u003c/A\u003eComponent"],"readme":"[![Build Status](https://travis-ci.org/kenglxn/QRGen.png?branch=master)](https://travis-ci.org/kenglxn/QRGen)\n[![Release](https://img.shields.io/github/tag/kenglxn/QRGen.svg?label=JitPack)](https://jitpack.io/#kenglxn/QRGen)\n\n### QRGen: a simple QRCode generation api for java built on top ZXING\n\nPlease consider [sponsoring](https://github.com/sponsors/kenglxn) the work on QRGen \n\n#### Dependencies:\n\nZXING: http://code.google.com/p/zxing/\n\n#### Get it:\n\nQRGen consists of three modules: ```core```, ```javase``` and ```android```.\n\nAs of 2.1.0 QRGen is available from [jitpack.io](https://jitpack.io/#kenglxn/QRGen). QRGen is no longer deployed to maven central (ref: #61).\nOlder releases are available from [Maven Central Repository](http://search.maven.org/#browse%7C-852965118).\n\nAs of 3.0.1 java 11 is required. \nLatest java 8 version is 2.7.0.\n\nMaven:\n\n```xml\n    \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003ejitpack.io\u003c/id\u003e\n            \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n        \u003c/repository\u003e\n    \u003c/repositories\u003e\n```\n\nGradle:\n\n```gradle\n    allprojects {\n        repositories {\n            // ...\n            maven { url \"https://jitpack.io\" }\n        }\n    }\n```\n\n##### Nexus proxy setup for jitpack\n\nSee https://github.com/jitpack/jitpack.io/issues/506 for solution.\n\n(thanks to @LTheobald for the heads up)\n\n#### Java Application\n\nWhen developing a Java application you need to add ```javase``` module to your list of dependencies. The required ```core``` module will be added automatically by your build system:\n\n\nGradle:\n\n```gradle\n    dependencies {\n        implementation 'com.github.kenglxn.QRGen:javase:3.0.1'\n    }\n```\n\nMaven:\n\n```xml\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.github.kenglxn.QRGen\u003c/groupId\u003e\n            \u003cartifactId\u003ejavase\u003c/artifactId\u003e\n            \u003cversion\u003e3.0.1\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n```\n\n##### Android\n\nWhen you want to use QRGen inside your android application you need to add the ```android``` module to your list of dependencies. The required ```core``` module will be added automatically by your build system:\n\nGradle:\n\n```gradle\n    dependencies {\n        implementation 'com.github.kenglxn.QRGen:android:3.0.1'\n    }\n```\n\nMaven:\n\n```xml\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.github.kenglxn.QRGen\u003c/groupId\u003e\n            \u003cartifactId\u003eandroid\u003c/artifactId\u003e\n            \u003cversion\u003e3.0.1\u003c/version\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n```\n\nOr you can clone and build yourself:\n\n```bash\n    git clone git://github.com/kenglxn/QRGen.git\n    cd QRGen/\n    mvn clean install\n```\n\n#### Usage:\n\n```java\npublic class Demo {\n    public static void main(String[] args) {\n        // get QR file from text using defaults\n        File file = QRCode.from(\"Hello World\").file();\n\n        // get QR stream from text using defaults\n        ByteArrayOutputStream stream = QRCode.from(\"Hello World\").stream();\n\n        // override the image type to be JPG\n        QRCode.from(\"Hello World\").to(ImageType.JPG).file();\n        QRCode.from(\"Hello World\").to(ImageType.JPG).stream();\n\n        // override image size to be 250x250\n        QRCode.from(\"Hello World\").withSize(250, 250).file();\n        QRCode.from(\"Hello World\").withSize(250, 250).stream();\n\n        // override size and image type\n        QRCode.from(\"Hello World\").to(ImageType.GIF).withSize(250, 250).file();\n        QRCode.from(\"Hello World\").to(ImageType.GIF).withSize(250, 250).stream();\n\n        // override default colors (black on white)\n        // notice that the color format is \"0x(alpha: 1 byte)(RGB: 3 bytes)\"\n        // so in the example below it's red for foreground and yellowish for background, both 100% alpha (FF).\n        QRCode.from(\"Hello World\").withColor(0xFFFF0000, 0xFFFFFFAA).file();\n\n        // supply own outputstream\n        QRCode.from(\"Hello World\").to(ImageType.PNG).writeTo(new ByteArrayOutputStream());\n\n        // supply own file name\n        QRCode.from(\"Hello World\").file(\"QRCode\");\n\n        // supply charset hint to ZXING\n        QRCode.from(\"Hello World\").withCharset(\"UTF-8\");\n\n        // supply error correction level hint to ZXING\n        QRCode.from(\"Hello World\").withErrorCorrection(ErrorCorrectionLevel.L);\n\n        // supply any hint to ZXING\n        QRCode.from(\"Hello World\").withHint(EncodeHintType.CHARACTER_SET, \"UTF-8\");\n\n        // encode contact data as vcard using defaults\n        VCard johnDoe = new VCard(\"John Doe\")\n                .setEmail(\"john.doe@example.org\")\n                .setAddress(\"John Doe Street 1, 5678 Doestown\")\n                .setTitle(\"Mister\")\n                .setCompany(\"John Doe Inc.\")\n                .setPhoneNumber(\"1234\")\n                .setWebsite(\"www.example.org\");\n        QRCode.from(johnDoe).file();\n\n        // encode email data\n        EMail email = new EMail(\"John.Doe@example.org\");\n        QRCode.from(email).file();\n\n        // encode mms data\n        MMS mms = new MMS(\"8675309\", \"Hello Jenny\");\n        QRCode.from(mms).file();\n\n        // encode sms data\n        SMS sms = new SMS(\"8675309\", \"Hello Jenny\");\n        QRCode.from(sms).file();\n\n        // encode MeCard data\n        MeCard janeDoe = new MeCard(\"Jane Doe\");\n        janeDoe.setEmail(\"john.doe@example.org\");\n        janeDoe.setAddress(\"John Doe Street 1, 5678 Doestown\");\n        janeDoe.setTelephone(\"1234\");\n        QRCode.from(janeDoe).file();\n\n        // if using special characters don't forget to supply the encoding\n        VCard johnSpecial = new VCard(\"Jöhn Dɵe\")\n                .setAddress(\"ëåäöƞ Sträät 1, 1234 Döestüwn\");\n        QRCode.from(johnSpecial).withCharset(\"UTF-8\").file();\n    }\n}\n```\n#### Java SE only\n\nWhen using java you can create svg files via `.svg()` terminal operator:\n\n```java\nFile file = QRCode.from(\"www.example.org\").svg();\nFile file = QRCode.from(\"www.example.com\").withSize(250, 250).withColor(30, 90).svg();\n```\n\nIt's also possible to write svg to an `OutputStream` with terminal operation:\n\n```java\nOutputStream outs = // ...\nQRCode.from(\"www.example.org\").svg(outs);\n```\n\n#### Android only\n\nOn Android you have a special method `bitmap()` which returns a `android.graphics.Bitmap` without creating a `File` object before, so you can use the generated `android.graphics.Bitmap` immediately inside an `ImageView`:\n\n```java\nBitmap myBitmap = QRCode.from(\"www.example.org\").bitmap();\nImageView myImage = (ImageView) findViewById(R.id.imageView);\nmyImage.setImageBitmap(myBitmap);\n```\n\n#### License:\n\nhttp://www.apache.org/licenses/LICENSE-2.0.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenglxn%2FQRGen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenglxn%2FQRGen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenglxn%2FQRGen/lists"}