fastqr 1.0.20 → 1.0.22

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.
@@ -0,0 +1,448 @@
1
+ # FastQR
2
+
3
+ [![License](https://img.shields.io/badge/License-LGPL%202.1-blue.svg)](LICENSE)
4
+ [![C++](https://img.shields.io/badge/C++-14-blue.svg)](https://isocpp.org/)
5
+ [![C](https://img.shields.io/badge/C-11-blue.svg)](https://en.wikipedia.org/wiki/C11_(C_standard_revision))
6
+ [![CMake](https://img.shields.io/badge/CMake-3.10+-064F8C.svg)](https://cmake.org/)
7
+ [![Shell](https://img.shields.io/badge/Shell-Bash-4EAA25.svg)](https://www.gnu.org/software/bash/)
8
+ [![JavaScript](https://img.shields.io/badge/JavaScript-ES6+-F7DF1E.svg)](https://www.ecma-international.org/ecma-262/)
9
+ [![Ruby](https://img.shields.io/badge/Ruby-Gem-red.svg)](https://rubygems.org/gems/fastqr)
10
+ [![Node.js](https://img.shields.io/badge/Node.js-npm-green.svg)](https://www.npmjs.com/package/fastqr)
11
+ [![PHP](https://img.shields.io/badge/PHP-Composer-blue.svg)](https://packagist.org/packages/fastqr/fastqr)
12
+
13
+ **The fastest QR code generator on the planet.** 🚀
14
+
15
+ Generate 1,000 QR codes in **0.37 seconds**. Full UTF-8 support. Custom colors. Logo embedding. Precise size control.
16
+
17
+ ---
18
+
19
+ ## 🔥 Performance Benchmarks
20
+
21
+ ### ⌨️ CLI Performance: FastQR vs qrencode
22
+
23
+ *Task: Generate 1,000 QR codes (500×500px)*
24
+
25
+ | Library | Sequential Mode | Batch Mode | Speedup |
26
+ |---------|----------------|------------|---------|
27
+ | **FastQR** | 2.56s 🚀 | **0.37s** ⚡ | **8x faster** with batch |
28
+ | qrencode | 2.97s 🐌 | ❌ Not supported | - |
29
+
30
+ **FastQR is 16% faster in sequential mode and 8x faster with batch mode!**
31
+
32
+ ---
33
+
34
+ ### 💎 Ruby Performance: FastQR vs rqrcode
35
+
36
+ *Task: Generate 1,000 QR codes (500×500px)*
37
+
38
+ | Library | Sequential Mode | Batch Mode | Speedup |
39
+ |---------|----------------|------------|---------|
40
+ | **FastQR** | 3.49s 🚀 | **0.38s** ⚡ | **17x faster** with batch |
41
+ | rqrcode | 59.45s 🐢 | ❌ Not supported | - |
42
+
43
+ **FastQR is 17x faster in sequential mode and 157x faster with batch mode!**
44
+
45
+ ---
46
+
47
+ ### 🟢 Node.js Performance: FastQR vs qrcode
48
+
49
+ *Task: Generate 1,000 QR codes (500×500px)*
50
+
51
+ | Library | Sequential Mode | Batch Mode | Speedup |
52
+ |---------|----------------|------------|---------|
53
+ | **FastQR** | 2.43s 🚀 | **0.46s** ⚡ | **7x faster** with batch |
54
+ | qrcode | 17.25s 🐌 | ❌ Not supported | - |
55
+
56
+ **FastQR is 7x faster in sequential mode and 37x faster with batch mode!**
57
+
58
+ ---
59
+
60
+ ### 🐘 PHP Performance: FastQR vs endroid/qr-code
61
+
62
+ *Task: Generate 1,000 QR codes (500×500px)*
63
+
64
+ | Library | Sequential Mode | Batch Mode | Speedup |
65
+ |---------|----------------|------------|---------|
66
+ | **FastQR** | 1.75s 🚀 | **0.64s** ⚡ | **8.4x faster** with batch |
67
+ | endroid/qr-code | 14.72s 🐌 | ❌ Not supported | - |
68
+
69
+ **FastQR is 8.4x faster in sequential mode and 23x faster with batch mode!**
70
+
71
+ ---
72
+
73
+ ## 💪 Why FastQR Dominates
74
+
75
+ ### Speed Comparison Summary
76
+
77
+ | Platform | Library | Sequential | Batch | FastQR Advantage |
78
+ |----------|---------|------------|-------|------------------|
79
+ | **⌨️ CLI** | qrencode | 2.97s | ❌ | **8x faster** ⚡ |
80
+ | **💎 Ruby** | rqrcode | 59.45s | ❌ | **157x faster** 🚀 |
81
+ | **🟢 Node.js** | qrcode | 17.25s | ❌ | **37x faster** ⚡ |
82
+ | **🐘 PHP** | endroid/qr-code | 14.72s | ❌ | **23x faster** 🚀 |
83
+
84
+ **Average: FastQR with batch mode is 56x faster than popular alternatives!**
85
+
86
+ ---
87
+
88
+ ## ✨ What Makes FastQR Special?
89
+
90
+ ### Features That Set Us Apart
91
+
92
+ | Feature | FastQR | Others |
93
+ |---------|--------|--------|
94
+ | **Batch Processing** | ✅ Up to 157x faster | ❌ Not available |
95
+ | **Exact Size Control** | ✅ 2000×2000px exact | ❌ Scale-based (imprecise) |
96
+ | **Full UTF-8 Support** | ✅ Vietnamese, Japanese, Chinese, emoji | ⚠️ Limited or none |
97
+ | **Custom Colors** | ✅ RGB foreground + background | ⚠️ Limited or none |
98
+ | **Logo Embedding** | ✅ Built-in logo support | ⚠️ Limited or none |
99
+ | **Language Bindings** | ✅ Ruby, Node.js, PHP, C++ | ✅ Usually supported |
100
+ | **Error Correction** | ✅ 4 levels (L, M, Q, H) | ✅ Usually supported |
101
+
102
+ ---
103
+
104
+ ## 🚀 Key Features
105
+
106
+ - ⚡ **Blazing Fast**: Up to **157x faster** than popular alternatives with batch mode
107
+ - 🔥 **Batch Processing**: Generate 1,000 QR codes in **~0.37 seconds**
108
+ - 🌐 **Full UTF-8 Support**: Vietnamese, Japanese (Kanji, Hiragana, Katakana), Chinese, emoji, and more
109
+ - 🎨 **Custom Colors**: Choose any RGB color for QR code and background
110
+ - 📐 **Exact Size Control**: Generate QR codes with precise pixel dimensions (e.g., 2000×2000px)
111
+ - 🖼️ **Logo Embedding**: Add company logos to the center of QR codes
112
+ - 🛡️ **Error Correction**: Supports 4 levels (L, M, Q, H)
113
+ - 💾 **Multiple Formats**: PNG, JPG, WebP
114
+ - 🔧 **Multiple Languages**: Native bindings for Ruby, Node.js, PHP, and C++
115
+
116
+ ---
117
+
118
+ ## 📦 Installation
119
+
120
+ ### CLI Installation
121
+
122
+ **macOS (Homebrew):**
123
+ ```bash
124
+ brew tap tranhuucanh/fastqr
125
+ brew install fastqr
126
+ ```
127
+
128
+ **Linux (x86_64):**
129
+ ```bash
130
+ # Download latest release (replace VERSION with latest version, e.g., 1.0.21)
131
+ VERSION="1.0.21"
132
+ wget https://github.com/tranhuucanh/fastqr/releases/download/v${VERSION}/fastqr-${VERSION}-linux-x86_64.tar.gz
133
+ tar -xzf fastqr-${VERSION}-linux-x86_64.tar.gz
134
+ sudo cp linux-x86_64/bin/fastqr /usr/local/bin/
135
+ sudo chmod +x /usr/local/bin/fastqr
136
+
137
+ # Verify installation
138
+ fastqr --version
139
+ ```
140
+
141
+ **Linux (ARM64/aarch64):**
142
+ ```bash
143
+ VERSION="1.0.21"
144
+ wget https://github.com/tranhuucanh/fastqr/releases/download/v${VERSION}/fastqr-${VERSION}-linux-aarch64.tar.gz
145
+ tar -xzf fastqr-${VERSION}-linux-aarch64.tar.gz
146
+ sudo cp linux-aarch64/bin/fastqr /usr/local/bin/
147
+ sudo chmod +x /usr/local/bin/fastqr
148
+ ```
149
+
150
+ ### Language Packages
151
+
152
+ **Ruby:**
153
+ ```bash
154
+ gem install fastqr
155
+ ```
156
+
157
+ **Node.js:**
158
+ ```bash
159
+ npm install fastqr-pro
160
+ ```
161
+
162
+ **PHP:**
163
+ ```bash
164
+ composer require fastqr/fastqr
165
+ ```
166
+
167
+ ### Build from Source
168
+
169
+ ```bash
170
+ # Install dependencies
171
+ # macOS:
172
+ brew install qrencode libpng cmake
173
+
174
+ # Ubuntu/Debian:
175
+ sudo apt-get install libqrencode-dev libpng-dev cmake build-essential
176
+
177
+ # Build
178
+ git clone https://github.com/tranhuucanh/fastqr.git
179
+ cd fastqr
180
+ mkdir build && cd build
181
+ cmake ..
182
+ make
183
+ sudo make install
184
+ ```
185
+
186
+ See [INSTALL.md](INSTALL.md) for more options.
187
+
188
+ ---
189
+
190
+ ## 🎯 Quick Start
191
+
192
+ ### CLI
193
+
194
+ **Single QR Code:**
195
+ ```bash
196
+ fastqr "Hello World" output.png
197
+ fastqr -s 500 -f 255,0,0 "Red QR" red.png
198
+ fastqr -l logo.png -L 25 "QR with Logo" branded.png
199
+ ```
200
+
201
+ **Batch Mode (8x faster!):**
202
+ ```bash
203
+ # Create batch.txt with one text per line
204
+ echo "https://example.com/user/1" > batch.txt
205
+ echo "https://example.com/user/2" >> batch.txt
206
+ # ... add 1000 URLs
207
+
208
+ # Generate 1,000 QR codes in 0.37 seconds ⚡
209
+ fastqr -F batch.txt output_dir/
210
+ ```
211
+
212
+ ---
213
+
214
+ ### Ruby
215
+
216
+ ```ruby
217
+ require 'fastqr'
218
+
219
+ # Single QR code
220
+ FastQR.generate("Hello World", "qr.png", size: 500)
221
+
222
+ # Batch mode - 157x faster than rqrcode! 🚀
223
+ urls = (1..1000).map { |i| "https://example.com/user/#{i}" }
224
+ FastQR.generate_batch(urls, "output/")
225
+ # ⚡ Done in 0.38 seconds! (vs 59.45s with rqrcode)
226
+
227
+ # Custom colors and logo
228
+ FastQR.generate("https://example.com", "branded.png",
229
+ size: 800,
230
+ foreground: [255, 0, 0], # Red QR code
231
+ background: [255, 255, 200], # Light yellow background
232
+ logo: "logo.png",
233
+ logoSize: 20,
234
+ errorLevel: "H" # High error correction for logos
235
+ )
236
+ ```
237
+
238
+ ---
239
+
240
+ ### Node.js
241
+
242
+ ```javascript
243
+ const fastqr = require('fastqr');
244
+
245
+ // Single QR code
246
+ fastqr.generate('Hello World', 'qr.png', { size: 500 });
247
+
248
+ // Batch mode - 37x faster than qrcode! 🚀
249
+ const urls = Array.from({length: 1000}, (_, i) =>
250
+ `https://example.com/user/${i+1}`
251
+ );
252
+ fastqr.generateBatch(urls, 'output/');
253
+ // ⚡ Done in 0.46 seconds! (vs 17.25s with qrcode)
254
+
255
+ // Custom colors and logo
256
+ fastqr.generate('https://example.com', 'branded.png', {
257
+ size: 800,
258
+ foreground: [255, 0, 0], // Red QR code
259
+ background: [255, 255, 200], // Light yellow background
260
+ logo: 'logo.png',
261
+ logoSize: 20,
262
+ errorLevel: 'H' // High error correction for logos
263
+ });
264
+ ```
265
+
266
+ ---
267
+
268
+ ### PHP
269
+
270
+ ```php
271
+ use FastQR\FastQR;
272
+
273
+ // Single QR code
274
+ FastQR::generate('Hello World', 'qr.png', ['size' => 500]);
275
+
276
+ // Batch mode - Lightning fast! ⚡
277
+ $urls = array_map(fn($i) => "https://example.com/user/$i", range(1, 1000));
278
+ FastQR::generateBatch($urls, 'output/');
279
+ // Done in ~0.4 seconds!
280
+
281
+ // Custom colors and logo
282
+ FastQR::generate('https://example.com', 'branded.png', [
283
+ 'size' => 800,
284
+ 'foreground' => [255, 0, 0], // Red QR code
285
+ 'background' => [255, 255, 200], // Light yellow background
286
+ 'logo' => 'logo.png',
287
+ 'logoSize' => 20,
288
+ 'errorLevel' => 'H' // High error correction for logos
289
+ ]);
290
+ ```
291
+
292
+ ---
293
+
294
+ ### C++
295
+
296
+ ```cpp
297
+ #include <fastqr.h>
298
+
299
+ // Single QR code
300
+ fastqr::QROptions options;
301
+ options.size = 500;
302
+ fastqr::generate("Hello World", "qr.png", options);
303
+
304
+ // Batch mode - Blazing fast! 🚀
305
+ std::vector<std::string> urls;
306
+ for (int i = 1; i <= 1000; i++) {
307
+ urls.push_back("https://example.com/user/" + std::to_string(i));
308
+ }
309
+ fastqr::generateBatch(urls, "output/", options);
310
+ // Done in ~0.4 seconds!
311
+ ```
312
+
313
+ ---
314
+
315
+ ## 📖 API Reference
316
+
317
+ ### QROptions
318
+
319
+ | Option | Type | Default | Description |
320
+ |--------|------|---------|-------------|
321
+ | `size` | int | 300 | Output size in pixels (QR codes are square) |
322
+ | `optimizeSize` | bool | false | Auto round-up to nearest integer multiple |
323
+ | `foreground` | RGB array | [0,0,0] | QR code color (RGB) |
324
+ | `background` | RGB array | [255,255,255] | Background color (RGB) |
325
+ | `errorLevel` | string | 'M' | Error correction: L, M, Q, H |
326
+ | `logo` | string | "" | Path to logo image |
327
+ | `logoSize` | int | 20 | Logo size as percentage (1-50) |
328
+ | `quality` | int | 95 | Image quality for lossy formats (1-100) |
329
+ | `format` | string | 'png' | Output format: png, jpg, webp |
330
+
331
+ ### Error Correction Levels
332
+
333
+ | Level | Recovery | Use Case |
334
+ |-------|----------|----------|
335
+ | **L (Low)** | ~7% | Maximum data capacity, clean environment |
336
+ | **M (Medium)** | ~15% | Balanced (default) |
337
+ | **Q (Quartile)** | ~25% | Good for QR codes with logos |
338
+ | **H (High)** | ~30% | Best for damaged/dirty environments |
339
+
340
+ Higher levels allow QR codes to remain readable when damaged or have logos embedded.
341
+
342
+ ---
343
+
344
+ ## 📚 Documentation
345
+
346
+ Complete usage guides for each platform:
347
+
348
+ - **[CLI Usage Guide](docs/CLI_USAGE.md)** - Complete command-line reference
349
+ - **[Ruby/Rails Usage Guide](docs/RUBY_USAGE.md)** - Ruby and Rails integration
350
+ - **[Node.js Usage Guide](docs/NODEJS_USAGE.md)** - Node.js, Express, and TypeScript
351
+ - **[PHP Usage Guide](docs/PHP_USAGE.md)** - PHP, Laravel, and WordPress integration
352
+ - **[Documentation Index](docs/README.md)** - Full documentation portal
353
+
354
+ ---
355
+
356
+ ## 🏗️ Architecture
357
+
358
+ FastQR is built on battle-tested, industry-standard libraries:
359
+
360
+ - **[libqrencode](https://fukuchi.org/works/qrencode/)** (LGPL v2.1) - QR code bit matrix generation
361
+ - **[libpng](http://www.libpng.org/pub/png/libpng.html)** - Lightning-fast PNG encoding
362
+ - **[stb_image](https://github.com/nothings/stb)** (Public Domain) - Efficient image loading
363
+
364
+ **Why so fast?**
365
+ - ⚡ Zero process forking overhead
366
+ - 🚀 Optimized native C++ core
367
+ - 💪 Batch mode processes multiple QR codes in a single call
368
+ - 🔥 Efficient memory management and image encoding
369
+
370
+ ---
371
+
372
+ ## 📄 License
373
+
374
+ FastQR is licensed under the **GNU Lesser General Public License v2.1 (LGPL-2.1)**.
375
+
376
+ ### LGPL Requirements
377
+
378
+ When using FastQR in your projects:
379
+
380
+ 1. **Open Source Projects**: Use freely ✅
381
+ 2. **Closed Source/Commercial Projects**: Use as a library, but:
382
+ - Include a copy of the LGPL license
383
+ - State that your software uses FastQR
384
+ - Users must be able to replace FastQR with a modified version
385
+
386
+ See [LICENSE](LICENSE) for full details.
387
+
388
+ ---
389
+
390
+ ## 🤝 Contributing
391
+
392
+ Contributions are welcome! Please feel free to submit a Pull Request.
393
+
394
+ 1. Fork the repository
395
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
396
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
397
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
398
+ 5. Open a Pull Request
399
+
400
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
401
+
402
+ ---
403
+
404
+ ## 🐛 Bug Reports
405
+
406
+ Found a bug? Please open an issue with:
407
+ - Your OS and version
408
+ - FastQR version
409
+ - Steps to reproduce
410
+ - Expected vs actual behavior
411
+
412
+ ---
413
+
414
+ ## 🗺️ Roadmap
415
+
416
+ - [ ] Windows support
417
+ - [ ] SVG output format
418
+ - [ ] Python bindings
419
+ - [ ] QR code scanning/decoding
420
+ - [ ] Advanced batch processing options
421
+
422
+ ---
423
+
424
+ ## 📮 Contact
425
+
426
+ - **GitHub**: [@tranhuucanh](https://github.com/tranhuucanh)
427
+ - **Issues**: [GitHub Issues](https://github.com/tranhuucanh/fastqr/issues)
428
+
429
+ ---
430
+
431
+ ## 🙏 Acknowledgments
432
+
433
+ Special thanks to:
434
+ - [libqrencode](https://fukuchi.org/works/qrencode/) by Kentaro Fukuchi
435
+ - [libpng](http://www.libpng.org/pub/png/libpng.html) by PNG Development Group
436
+ - [stb libraries](https://github.com/nothings/stb) by Sean Barrett
437
+
438
+ ---
439
+
440
+ <div align="center">
441
+
442
+ **Made with ❤️ by FastQR Project**
443
+
444
+ *If FastQR saves you time, give us a star!* ⭐
445
+
446
+ [⬆ Back to top](#fastqr-)
447
+
448
+ </div>
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastqr-pro",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "Fast QR code generator with UTF-8 support, custom colors, logo embedding, and precise size control",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,7 +17,6 @@
17
17
  "vietnamese",
18
18
  "japanese",
19
19
  "fast",
20
- "vips",
21
20
  "image"
22
21
  ],
23
22
  "author": "FastQR Project",