fastqr 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/BUILD.md +482 -0
- data/CHANGELOG.md +51 -0
- data/CMakeLists.txt +126 -0
- data/CONTRIBUTING.md +63 -0
- data/DISTRIBUTION.md +730 -0
- data/INSTALL.md +171 -0
- data/LICENSE +39 -0
- data/PREBUILT.md +171 -0
- data/README.md +312 -0
- data/VERSION +1 -0
- data/bindings/nodejs/binding.gyp +38 -0
- data/bindings/nodejs/fastqr_node.cpp +125 -0
- data/bindings/nodejs/index.d.ts +80 -0
- data/bindings/nodejs/index.js +187 -0
- data/bindings/nodejs/lib/platform.js +72 -0
- data/bindings/nodejs/package.json +45 -0
- data/bindings/nodejs/test/test.js +45 -0
- data/bindings/php/fastqr_php.cpp +85 -0
- data/bindings/php/src/FastQR.php +316 -0
- data/bindings/php/tests/FastQRTest.php +97 -0
- data/bindings/ruby/extconf.rb +29 -0
- data/bindings/ruby/fastqr_ruby.cpp +122 -0
- data/bindings/ruby/lib/fastqr/platform.rb +70 -0
- data/bindings/ruby/lib/fastqr/version.rb +6 -0
- data/bindings/ruby/lib/fastqr.rb +129 -0
- data/bindings/ruby/prebuilt/macos-arm64.tar.gz +1 -0
- data/bindings/ruby/prebuilt/macos-x86_64.tar.gz +1 -0
- data/build.sh +109 -0
- data/cmake/fastqrConfig.cmake.in +6 -0
- data/composer.json +36 -0
- data/docs/CLI_USAGE.md +478 -0
- data/docs/NODEJS_USAGE.md +694 -0
- data/docs/PHP_USAGE.md +815 -0
- data/docs/README.md +191 -0
- data/docs/RUBY_USAGE.md +537 -0
- data/examples/CMakeLists.txt +7 -0
- data/examples/basic.cpp +58 -0
- data/include/fastqr.h +97 -0
- data/include/stb_image.h +7988 -0
- data/include/stb_image_write.h +1724 -0
- data/phpunit.xml +18 -0
- data/prebuilt/README.md +131 -0
- data/scripts/README.md +248 -0
- data/scripts/build-binaries.sh +98 -0
- data/scripts/build-local.sh +18 -0
- data/scripts/install.sh +87 -0
- data/scripts/release.sh +78 -0
- data/scripts/update-version.sh +58 -0
- data/src/cli.cpp +316 -0
- data/src/fastqr.cpp +665 -0
- data/test.sh +86 -0
- metadata +155 -0
data/INSTALL.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Installation Guide
|
|
2
|
+
|
|
3
|
+
FastQR can be installed in multiple ways depending on your needs and platform.
|
|
4
|
+
|
|
5
|
+
## 📦 Quick Install
|
|
6
|
+
|
|
7
|
+
### macOS (Homebrew)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
brew tap tranhuucanh/fastqr
|
|
11
|
+
brew install fastqr
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This installs the CLI tool and libraries system-wide.
|
|
15
|
+
|
|
16
|
+
### Language-Specific Packages
|
|
17
|
+
|
|
18
|
+
**Ruby (Gem):**
|
|
19
|
+
```bash
|
|
20
|
+
gem install fastqr
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Node.js (npm):**
|
|
24
|
+
```bash
|
|
25
|
+
npm install fastqr
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**PHP (Composer):**
|
|
29
|
+
```bash
|
|
30
|
+
composer require fastqr/fastqr
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**All language packages include pre-built binaries - no system dependencies required!**
|
|
34
|
+
|
|
35
|
+
## 🔨 Build from Source
|
|
36
|
+
|
|
37
|
+
### Prerequisites
|
|
38
|
+
|
|
39
|
+
- C++14 compatible compiler
|
|
40
|
+
- CMake 3.15+
|
|
41
|
+
- libqrencode 4.0+
|
|
42
|
+
- libvips 8.10+
|
|
43
|
+
|
|
44
|
+
### macOS
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install dependencies
|
|
48
|
+
brew install cmake qrencode vips
|
|
49
|
+
|
|
50
|
+
# Clone and build
|
|
51
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
52
|
+
cd fastqr
|
|
53
|
+
./build.sh
|
|
54
|
+
|
|
55
|
+
# Install
|
|
56
|
+
cd build
|
|
57
|
+
sudo make install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Ubuntu/Debian
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Install dependencies
|
|
64
|
+
sudo apt-get update
|
|
65
|
+
sudo apt-get install -y cmake libqrencode-dev libvips-dev build-essential
|
|
66
|
+
|
|
67
|
+
# Clone and build
|
|
68
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
69
|
+
cd fastqr
|
|
70
|
+
./build.sh
|
|
71
|
+
|
|
72
|
+
# Install
|
|
73
|
+
cd build
|
|
74
|
+
sudo make install
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 📥 Pre-built Binaries
|
|
78
|
+
|
|
79
|
+
Download pre-built binaries from [GitHub Releases](https://github.com/tranhuucanh/fastqr/releases):
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Download and install
|
|
83
|
+
curl -fsSL https://raw.githubusercontent.com/tranhuucanh/fastqr/main/scripts/install.sh | bash
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or manually:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Download for your platform
|
|
90
|
+
wget https://github.com/tranhuucanh/fastqr/releases/download/v1.0.0/fastqr-1.0.0-macos-arm64.tar.gz
|
|
91
|
+
|
|
92
|
+
# Extract
|
|
93
|
+
tar xzf fastqr-1.0.0-macos-arm64.tar.gz
|
|
94
|
+
|
|
95
|
+
# Install
|
|
96
|
+
sudo cp -r macos-arm64/lib/* /usr/local/lib/
|
|
97
|
+
sudo cp -r macos-arm64/bin/* /usr/local/bin/
|
|
98
|
+
sudo cp -r macos-arm64/include/* /usr/local/include/
|
|
99
|
+
|
|
100
|
+
# On Linux, update library cache
|
|
101
|
+
sudo ldconfig
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 🧪 Verify Installation
|
|
105
|
+
|
|
106
|
+
### CLI Tool
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
fastqr --version
|
|
110
|
+
fastqr "Hello World" test.png
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Ruby
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
require 'fastqr'
|
|
117
|
+
puts FastQR.version
|
|
118
|
+
FastQR.generate("Hello", "test.png")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Node.js
|
|
122
|
+
|
|
123
|
+
```javascript
|
|
124
|
+
const fastqr = require('fastqr');
|
|
125
|
+
console.log(fastqr.version());
|
|
126
|
+
fastqr.generate('Hello', 'test.png');
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### PHP
|
|
130
|
+
|
|
131
|
+
```php
|
|
132
|
+
<?php
|
|
133
|
+
use FastQR\FastQR;
|
|
134
|
+
echo FastQR::version();
|
|
135
|
+
FastQR::generate('Hello', 'test.png');
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 📚 Next Steps
|
|
139
|
+
|
|
140
|
+
- Read the [README](README.md) for usage examples
|
|
141
|
+
- See [BUILD.md](BUILD.md) for detailed build instructions
|
|
142
|
+
- Check [DISTRIBUTION.md](DISTRIBUTION.md) for publishing guides
|
|
143
|
+
|
|
144
|
+
## ❓ Troubleshooting
|
|
145
|
+
|
|
146
|
+
**"Command not found" after installation:**
|
|
147
|
+
```bash
|
|
148
|
+
# Make sure /usr/local/bin is in your PATH
|
|
149
|
+
echo $PATH
|
|
150
|
+
export PATH="/usr/local/bin:$PATH"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**"Library not found" error:**
|
|
154
|
+
```bash
|
|
155
|
+
# macOS
|
|
156
|
+
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
|
|
157
|
+
|
|
158
|
+
# Linux
|
|
159
|
+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
|
160
|
+
sudo ldconfig
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Gem/npm/composer packages not finding binaries:**
|
|
164
|
+
|
|
165
|
+
This should not happen as binaries are pre-built and bundled. If it does:
|
|
166
|
+
1. Check your platform is supported
|
|
167
|
+
2. Try building from source
|
|
168
|
+
3. Open an issue on GitHub
|
|
169
|
+
|
|
170
|
+
For more help, see [BUILD.md](BUILD.md) or open an [issue](https://github.com/tranhuucanh/fastqr/issues).
|
|
171
|
+
|
data/LICENSE
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 2.1, February 1999
|
|
3
|
+
|
|
4
|
+
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
5
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
6
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
7
|
+
of this license document, but changing it is not allowed.
|
|
8
|
+
|
|
9
|
+
[This is the first released version of the Lesser GPL. It also counts
|
|
10
|
+
as the successor of the GNU Library Public License, version 2, hence
|
|
11
|
+
the version number 2.1.]
|
|
12
|
+
|
|
13
|
+
This library is free software; you can redistribute it and/or
|
|
14
|
+
modify it under the terms of the GNU Lesser General Public
|
|
15
|
+
License as published by the Free Software Foundation; either
|
|
16
|
+
version 2.1 of the License, or (at your option) any later version.
|
|
17
|
+
|
|
18
|
+
This library is distributed in the hope that it will be useful,
|
|
19
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
21
|
+
Lesser General Public License for more details.
|
|
22
|
+
|
|
23
|
+
You should have received a copy of the GNU Lesser General Public
|
|
24
|
+
License along with this library; if not, write to the Free Software
|
|
25
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
FastQR - Fast QR Code Generator Library
|
|
30
|
+
Copyright (C) 2025 FastQR Project
|
|
31
|
+
|
|
32
|
+
This project statically links with:
|
|
33
|
+
- libqrencode (LGPL v2.1) - Copyright (C) 2006-2017 Kentaro Fukuchi
|
|
34
|
+
- libvips (LGPL v2.1+) - Copyright (C) 1989-2021 Imperial College, London
|
|
35
|
+
|
|
36
|
+
As required by the LGPL, you can obtain the source code and rebuild this
|
|
37
|
+
library with modified versions of libqrencode and libvips. See BUILD.md
|
|
38
|
+
for instructions.
|
|
39
|
+
|
data/PREBUILT.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Pre-built Binaries Release Process
|
|
2
|
+
|
|
3
|
+
This document describes how pre-built binaries are generated and distributed for FastQR.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Starting from v1.0.0, FastQR includes pre-built binaries in all language packages (Ruby, Node.js, PHP). This means users can install packages without needing to install system dependencies (libqrencode, libvips).
|
|
8
|
+
|
|
9
|
+
## Supported Platforms
|
|
10
|
+
|
|
11
|
+
- **macOS**
|
|
12
|
+
- arm64 (Apple Silicon M1/M2/M3)
|
|
13
|
+
- x86_64 (Intel)
|
|
14
|
+
- **Linux**
|
|
15
|
+
- x86_64 (64-bit Intel/AMD)
|
|
16
|
+
- arm64 (64-bit ARM)
|
|
17
|
+
|
|
18
|
+
## How It Works
|
|
19
|
+
|
|
20
|
+
### 1. Building Binaries
|
|
21
|
+
|
|
22
|
+
When a new tag is pushed, the GitHub Actions workflow `.github/workflows/build-binaries.yml` automatically:
|
|
23
|
+
|
|
24
|
+
1. Builds binaries for all 4 platforms
|
|
25
|
+
2. Creates tarballs for each platform
|
|
26
|
+
3. Extracts and organizes binaries into binding directories
|
|
27
|
+
4. Commits binaries to the repository
|
|
28
|
+
5. Creates GitHub Release with all assets
|
|
29
|
+
|
|
30
|
+
### 2. Platform Detection & Loading
|
|
31
|
+
|
|
32
|
+
Each language binding automatically detects the platform and loads the appropriate binary:
|
|
33
|
+
|
|
34
|
+
**Ruby:**
|
|
35
|
+
```ruby
|
|
36
|
+
# bindings/ruby/lib/fastqr/platform.rb
|
|
37
|
+
FastQR::Platform.platform # => "macos-arm64"
|
|
38
|
+
FastQR::Platform.lib_path # => Path to pre-built binary
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Node.js:**
|
|
42
|
+
```javascript
|
|
43
|
+
// bindings/nodejs/lib/platform.js
|
|
44
|
+
platform.detectPlatform() // => "macos-arm64"
|
|
45
|
+
platform.getPrebuiltPath() // => Path to pre-built binary
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**PHP:**
|
|
49
|
+
```php
|
|
50
|
+
// bindings/php/src/FastQR.php
|
|
51
|
+
// Auto-detects platform and loads binary via FFI
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 3. Distribution
|
|
55
|
+
|
|
56
|
+
**Ruby Gem:**
|
|
57
|
+
- Pre-built binaries are included in `bindings/ruby/prebuilt/`
|
|
58
|
+
- Gem is published to RubyGems.org
|
|
59
|
+
- Users: `gem install fastqr` (no dependencies needed!)
|
|
60
|
+
|
|
61
|
+
**npm Package:**
|
|
62
|
+
- Pre-built binaries are included in `bindings/nodejs/prebuilt/`
|
|
63
|
+
- Package is published to npm
|
|
64
|
+
- Users: `npm install fastqr` (no dependencies needed!)
|
|
65
|
+
|
|
66
|
+
**Composer Package:**
|
|
67
|
+
- Pre-built binaries are committed to repository in `bindings/php/prebuilt/`
|
|
68
|
+
- Package is published to Packagist
|
|
69
|
+
- Users: `composer require fastqr/fastqr` (no dependencies needed!)
|
|
70
|
+
|
|
71
|
+
## Release Checklist
|
|
72
|
+
|
|
73
|
+
When releasing a new version:
|
|
74
|
+
|
|
75
|
+
1. **Update version** in all files:
|
|
76
|
+
```bash
|
|
77
|
+
# CMakeLists.txt, package.json, gemspec, etc.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
2. **Tag and push**:
|
|
81
|
+
```bash
|
|
82
|
+
git tag -a v1.0.1 -m "Release 1.0.1"
|
|
83
|
+
git push origin v1.0.1
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
3. **GitHub Actions will**:
|
|
87
|
+
- Build binaries for all platforms
|
|
88
|
+
- Create GitHub Release
|
|
89
|
+
- Commit binaries to repository
|
|
90
|
+
|
|
91
|
+
4. **Publish packages**:
|
|
92
|
+
```bash
|
|
93
|
+
# Ruby
|
|
94
|
+
gem build fastqr.gemspec
|
|
95
|
+
gem push fastqr-1.0.1.gem
|
|
96
|
+
|
|
97
|
+
# Node.js
|
|
98
|
+
cd bindings/nodejs
|
|
99
|
+
npm publish
|
|
100
|
+
|
|
101
|
+
# PHP (auto via webhook)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Manual Build
|
|
105
|
+
|
|
106
|
+
To build binaries manually:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Build for current platform
|
|
110
|
+
./scripts/build-binaries.sh
|
|
111
|
+
|
|
112
|
+
# Output: prebuilt/fastqr-VERSION-PLATFORM.tar.gz
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Binary Structure
|
|
116
|
+
|
|
117
|
+
Each platform binary tarball contains:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
platform/
|
|
121
|
+
├── lib/
|
|
122
|
+
│ └── libfastqr.{dylib|so} # Shared library
|
|
123
|
+
├── bin/
|
|
124
|
+
│ └── fastqr # CLI tool
|
|
125
|
+
└── include/
|
|
126
|
+
└── fastqr.h # Header file
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Troubleshooting
|
|
130
|
+
|
|
131
|
+
**Problem**: Binary not found for platform
|
|
132
|
+
|
|
133
|
+
**Solution**: Check if platform is supported. If not, user must build from source.
|
|
134
|
+
|
|
135
|
+
**Problem**: Binary fails to load
|
|
136
|
+
|
|
137
|
+
**Solution**: Check file permissions and paths. On macOS, may need to allow in System Preferences → Security.
|
|
138
|
+
|
|
139
|
+
**Problem**: GitHub Actions build fails
|
|
140
|
+
|
|
141
|
+
**Solution**: Check build logs. Common issues:
|
|
142
|
+
- Missing dependencies
|
|
143
|
+
- Platform-specific build errors
|
|
144
|
+
- Network issues downloading dependencies
|
|
145
|
+
|
|
146
|
+
## Future Improvements
|
|
147
|
+
|
|
148
|
+
- [ ] Add Windows support
|
|
149
|
+
- [ ] Add more Linux distributions (Alpine, CentOS)
|
|
150
|
+
- [ ] Optimize binary size
|
|
151
|
+
- [ ] Add binary verification/signing
|
|
152
|
+
- [ ] Cache dependencies in CI for faster builds
|
|
153
|
+
|
|
154
|
+
## License Compliance
|
|
155
|
+
|
|
156
|
+
Pre-built binaries statically link libqrencode and libvips (both LGPL 2.1).
|
|
157
|
+
|
|
158
|
+
To comply with LGPL:
|
|
159
|
+
1. LICENSE file is included in all packages
|
|
160
|
+
2. BUILD.md provides instructions for rebuilding with custom libraries
|
|
161
|
+
3. Source code is available on GitHub
|
|
162
|
+
4. Attribution is included in README
|
|
163
|
+
|
|
164
|
+
## Resources
|
|
165
|
+
|
|
166
|
+
- [GitHub Actions Workflow](.github/workflows/build-binaries.yml)
|
|
167
|
+
- [Build Script](scripts/build-binaries.sh)
|
|
168
|
+
- [Platform Detection (Ruby)](bindings/ruby/lib/fastqr/platform.rb)
|
|
169
|
+
- [Platform Detection (Node.js)](bindings/nodejs/lib/platform.js)
|
|
170
|
+
- [Pre-built Binaries Directory](prebuilt/)
|
|
171
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# FastQR
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://isocpp.org/)
|
|
5
|
+
[](https://rubygems.org/gems/fastqr)
|
|
6
|
+
[](https://www.npmjs.com/package/fastqr)
|
|
7
|
+
[](https://packagist.org/packages/fastqr/fastqr)
|
|
8
|
+
|
|
9
|
+
FastQR is a fast, powerful QR code generator with full UTF-8 support, custom colors, logo embedding, and precise size control. **Pre-built binaries included**!
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🚀 **High Performance**: No process forking
|
|
14
|
+
- ⚡ **Batch Mode**: Generate 1000 QR codes in ~0.4s (7x faster than single mode!)
|
|
15
|
+
- 🌐 **Full UTF-8 Support**: Vietnamese, Japanese (Kanji, Hiragana, Katakana), Chinese, emoji, etc.
|
|
16
|
+
- 🎨 **Custom Colors**: Choose colors for QR code and background
|
|
17
|
+
- 📐 **Exact Size**: Generate QR codes with precise pixel dimensions (e.g., 2000x2000px)
|
|
18
|
+
- 🖼️ **Logo Embedding**: Add company logos to the center of QR codes
|
|
19
|
+
- 📦 **Multiple Languages**: Bindings for Ruby, Node.js, PHP
|
|
20
|
+
- 🛡️ **Error Correction**: Supports 4 levels (L, M, Q, H)
|
|
21
|
+
- 💾 **Multiple Formats**: PNG, JPG, WebP
|
|
22
|
+
- ✅ **Pre-built Binaries**: No dependencies needed for gem/npm/composer packages!
|
|
23
|
+
|
|
24
|
+
## 🎯 Comparison with qrencode
|
|
25
|
+
|
|
26
|
+
| Feature | FastQR | qrencode |
|
|
27
|
+
|---------|--------|----------|
|
|
28
|
+
| **Speed** | ✅ The same | ✅ The same |
|
|
29
|
+
| **Exact Size** | ✅ 2000x2000px exact | ❌ Scale-based (hard to be exact) |
|
|
30
|
+
| **UTF-8 Support** | ✅ Full | ⚠️ Limited |
|
|
31
|
+
| **Colors** | ✅ RGB customizable | ❌ Black only |
|
|
32
|
+
| **Logo** | ✅ Yes | ❌ No |
|
|
33
|
+
| **Bindings** | ✅ Ruby, Node.js, PHP | ❌ CLI only |
|
|
34
|
+
| **Installation** | ✅ Pre-built binaries | ❌ Requires system deps |
|
|
35
|
+
|
|
36
|
+
## 🏗️ Architecture
|
|
37
|
+
|
|
38
|
+
FastQR is built on:
|
|
39
|
+
|
|
40
|
+
- **[libqrencode](https://fukuchi.org/works/qrencode/)** (LGPL v2.1) - QR code generation
|
|
41
|
+
- **[libpng](http://www.libpng.org/pub/png/libpng.html)** - Fast PNG encoding
|
|
42
|
+
- **[stb_image](https://github.com/nothings/stb)** (Public Domain) - Logo image loading
|
|
43
|
+
|
|
44
|
+
## 📦 Installation
|
|
45
|
+
|
|
46
|
+
### macOS (Homebrew)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
brew tap tranhuucanh/fastqr
|
|
50
|
+
brew install fastqr
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Ubuntu/Debian
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Download from GitHub Releases
|
|
57
|
+
wget https://github.com/tranhuucanh/fastqr/releases/download/v1.0.0/fastqr-1.0.0-linux-x64.deb
|
|
58
|
+
sudo dpkg -i fastqr-1.0.0-linux-x64.deb
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Language Packages (Pre-built Binaries Included!)
|
|
62
|
+
|
|
63
|
+
**Ruby:**
|
|
64
|
+
```bash
|
|
65
|
+
gem install fastqr
|
|
66
|
+
# No system dependencies needed! 🎉
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Node.js:**
|
|
70
|
+
```bash
|
|
71
|
+
npm install fastqr
|
|
72
|
+
# No system dependencies needed! 🎉
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**PHP:**
|
|
76
|
+
```bash
|
|
77
|
+
composer require fastqr/fastqr
|
|
78
|
+
# No system dependencies needed! 🎉
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Important**: Starting from v1.0.0, all language packages include pre-built binaries for:
|
|
82
|
+
- macOS (Intel & Apple Silicon)
|
|
83
|
+
- Linux (x86_64 & arm64)
|
|
84
|
+
|
|
85
|
+
You don't need to install `libqrencode` or `libpng` separately! The binaries are automatically bundled and loaded.
|
|
86
|
+
|
|
87
|
+
### Build from Source
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Install dependencies
|
|
91
|
+
# macOS:
|
|
92
|
+
brew install qrencode libpng cmake
|
|
93
|
+
|
|
94
|
+
# Ubuntu/Debian:
|
|
95
|
+
sudo apt-get install libqrencode-dev libpng-dev cmake build-essential
|
|
96
|
+
|
|
97
|
+
# Build
|
|
98
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
99
|
+
cd fastqr
|
|
100
|
+
mkdir build && cd build
|
|
101
|
+
cmake ..
|
|
102
|
+
make
|
|
103
|
+
sudo make install
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
See [INSTALL.md](INSTALL.md) for more installation options.
|
|
107
|
+
|
|
108
|
+
## 🚀 Quick Start
|
|
109
|
+
|
|
110
|
+
### CLI
|
|
111
|
+
```bash
|
|
112
|
+
fastqr "Hello World" output.png
|
|
113
|
+
fastqr -s 500 -f 255,0,0 "Red QR" red.png
|
|
114
|
+
fastqr -F batch.txt output_dir/ # Batch mode - 7x faster!
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Ruby
|
|
118
|
+
```bash
|
|
119
|
+
gem install fastqr # Pre-built binaries included!
|
|
120
|
+
```
|
|
121
|
+
```ruby
|
|
122
|
+
require 'fastqr'
|
|
123
|
+
FastQR.generate("Hello", "qr.png", size: 500)
|
|
124
|
+
FastQR.generate_batch(["QR 1", "QR 2"], "output/") # Batch mode
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Node.js
|
|
128
|
+
```bash
|
|
129
|
+
npm install fastqr # Pre-built binaries included!
|
|
130
|
+
```
|
|
131
|
+
```javascript
|
|
132
|
+
const fastqr = require('fastqr');
|
|
133
|
+
fastqr.generate('Hello', 'qr.png', { size: 500 });
|
|
134
|
+
fastqr.generateBatch(['QR 1', 'QR 2'], 'output/'); // Batch mode
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### PHP
|
|
138
|
+
```bash
|
|
139
|
+
composer require fastqr/fastqr # Pre-built binaries included!
|
|
140
|
+
```
|
|
141
|
+
```php
|
|
142
|
+
use FastQR\FastQR;
|
|
143
|
+
FastQR::generate('Hello', 'qr.png', ['size' => 500]);
|
|
144
|
+
FastQR::generateBatch(['QR 1', 'QR 2'], 'output/'); // Batch mode
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### C++
|
|
148
|
+
```cpp
|
|
149
|
+
#include <fastqr.h>
|
|
150
|
+
fastqr::QROptions options;
|
|
151
|
+
options.size = 500;
|
|
152
|
+
fastqr::generate("Hello", "qr.png", options);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 📚 Documentation
|
|
156
|
+
|
|
157
|
+
Complete usage guides for each platform:
|
|
158
|
+
|
|
159
|
+
- **[CLI Usage Guide](docs/CLI_USAGE.md)** - Complete command-line reference with all options and examples
|
|
160
|
+
- **[Ruby/Rails Usage Guide](docs/RUBY_USAGE.md)** - Ruby and Rails integration with examples
|
|
161
|
+
- **[Node.js Usage Guide](docs/NODEJS_USAGE.md)** - Node.js, Express, and TypeScript guide
|
|
162
|
+
- **[PHP Usage Guide](docs/PHP_USAGE.md)** - PHP, Laravel, and WordPress integration
|
|
163
|
+
- **[Documentation Index](docs/README.md)** - Full documentation portal
|
|
164
|
+
|
|
165
|
+
## 📖 API Reference
|
|
166
|
+
|
|
167
|
+
### QROptions
|
|
168
|
+
|
|
169
|
+
| Option | Type | Default | Description |
|
|
170
|
+
|--------|------|---------|-------------|
|
|
171
|
+
| `size` | int | 300 | Output size in pixels (QR codes are square) |
|
|
172
|
+
| `optimizeSize` | bool | false | Auto round-up to nearest integer multiple for best performance |
|
|
173
|
+
| `foreground` | RGB array | [0,0,0] | QR code color |
|
|
174
|
+
| `background` | RGB array | [255,255,255] | Background color |
|
|
175
|
+
| `errorLevel` | string | 'M' | Error correction: L (~7%), M (~15%), Q (~25%), H (~30%) |
|
|
176
|
+
| `logo` | string | "" | Path to logo image |
|
|
177
|
+
| `logoSize` | int | 20 | Logo size as percentage (1-50) |
|
|
178
|
+
| `quality` | int | 95 | Image quality for lossy formats (1-100) |
|
|
179
|
+
| `format` | string | 'png' | Output format: png, jpg, webp |
|
|
180
|
+
|
|
181
|
+
### Error Correction Levels
|
|
182
|
+
|
|
183
|
+
- **L (Low)**: ~7% of codewords can be restored
|
|
184
|
+
- **M (Medium)**: ~15% of codewords can be restored
|
|
185
|
+
- **Q (Quartile)**: ~25% of codewords can be restored
|
|
186
|
+
- **H (High)**: ~30% of codewords can be restored
|
|
187
|
+
|
|
188
|
+
Higher levels allow QR codes to remain readable when damaged or have logos embedded.
|
|
189
|
+
|
|
190
|
+
## 🔧 Development
|
|
191
|
+
|
|
192
|
+
### Build from Source
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
git clone https://github.com/tranhuucanh/fastqr.git
|
|
196
|
+
cd fastqr
|
|
197
|
+
|
|
198
|
+
# Install dependencies
|
|
199
|
+
brew install qrencode libpng cmake
|
|
200
|
+
|
|
201
|
+
# Build
|
|
202
|
+
mkdir build && cd build
|
|
203
|
+
cmake ..
|
|
204
|
+
make
|
|
205
|
+
|
|
206
|
+
# Run examples
|
|
207
|
+
./example_basic
|
|
208
|
+
|
|
209
|
+
# Run tests
|
|
210
|
+
make test
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Project Structure
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
fastqr/
|
|
217
|
+
├── include/ # C++ headers
|
|
218
|
+
│ ├── fastqr.h
|
|
219
|
+
│ ├── stb_image.h
|
|
220
|
+
│ └── stb_image_write.h
|
|
221
|
+
├── src/ # C++ source
|
|
222
|
+
│ ├── fastqr.cpp
|
|
223
|
+
│ └── cli.cpp
|
|
224
|
+
├── bindings/ # Language bindings
|
|
225
|
+
│ ├── ruby/
|
|
226
|
+
│ ├── nodejs/
|
|
227
|
+
│ └── php/
|
|
228
|
+
├── prebuilt/ # Pre-compiled binaries
|
|
229
|
+
│ ├── macos-arm64/
|
|
230
|
+
│ ├── macos-x86_64/
|
|
231
|
+
│ ├── linux-x86_64/
|
|
232
|
+
│ └── linux-arm64/
|
|
233
|
+
├── scripts/ # Build and install scripts
|
|
234
|
+
├── examples/ # Examples
|
|
235
|
+
├── cmake/ # CMake configs
|
|
236
|
+
└── LICENSE # LGPL 2.1
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## 📄 License
|
|
240
|
+
|
|
241
|
+
FastQR is licensed under the **GNU Lesser General Public License v2.1 (LGPL-2.1)**.
|
|
242
|
+
|
|
243
|
+
This project uses:
|
|
244
|
+
- **libqrencode** (LGPL v2.1) - Copyright (C) 2006-2017 Kentaro Fukuchi
|
|
245
|
+
- **libpng** - PNG image encoding
|
|
246
|
+
- **stb_image** (Public Domain) - Sean Barrett's single-header image library
|
|
247
|
+
|
|
248
|
+
As required by the LGPL, you can obtain the source code and rebuild this library with modified versions of libqrencode. See [BUILD.md](BUILD.md) for instructions.
|
|
249
|
+
|
|
250
|
+
### LGPL Requirements
|
|
251
|
+
|
|
252
|
+
When using FastQR in your projects:
|
|
253
|
+
|
|
254
|
+
1. **Open Source Projects**: You can freely use FastQR
|
|
255
|
+
2. **Closed Source/Commercial Projects**: You can use FastQR as a library, but:
|
|
256
|
+
- You must include a copy of the LGPL license
|
|
257
|
+
- You must state that your software uses FastQR
|
|
258
|
+
- Users must be able to replace the FastQR library with a modified version
|
|
259
|
+
|
|
260
|
+
See [LICENSE](LICENSE) for full details.
|
|
261
|
+
|
|
262
|
+
## 🤝 Contributing
|
|
263
|
+
|
|
264
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
265
|
+
|
|
266
|
+
1. Fork the repository
|
|
267
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
268
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
269
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
270
|
+
5. Open a Pull Request
|
|
271
|
+
|
|
272
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
|
|
273
|
+
|
|
274
|
+
## 🐛 Bug Reports
|
|
275
|
+
|
|
276
|
+
If you find a bug, please open an issue with:
|
|
277
|
+
- Your OS and version
|
|
278
|
+
- FastQR version
|
|
279
|
+
- Steps to reproduce
|
|
280
|
+
- Expected vs actual behavior
|
|
281
|
+
|
|
282
|
+
## 📮 Contact
|
|
283
|
+
|
|
284
|
+
- GitHub: [@tranhuucanh](https://github.com/tranhuucanh)
|
|
285
|
+
- Issues: [GitHub Issues](https://github.com/tranhuucanh/fastqr/issues)
|
|
286
|
+
|
|
287
|
+
## 🙏 Acknowledgments
|
|
288
|
+
|
|
289
|
+
- [libqrencode](https://fukuchi.org/works/qrencode/) by Kentaro Fukuchi
|
|
290
|
+
- [libpng](http://www.libpng.org/pub/png/libpng.html) by PNG Development Group
|
|
291
|
+
- [stb libraries](https://github.com/nothings/stb) by Sean Barrett
|
|
292
|
+
|
|
293
|
+
## 📊 Benchmarks
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
Generating 100 QR codes (500x500px): ~0.3 seconds
|
|
297
|
+
Generating 1000 QR codes (500x500px): ~3 seconds
|
|
298
|
+
|
|
299
|
+
Performance tested on modern hardware 🚀
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🗺️ Roadmap
|
|
303
|
+
|
|
304
|
+
- [ ] Windows support
|
|
305
|
+
- [ ] SVG output
|
|
306
|
+
- [ ] Python bindings
|
|
307
|
+
- [ ] Batch processing API
|
|
308
|
+
- [ ] QR code scanning/decoding
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
Made with ❤️ by FastQR Project
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.1
|