Top Related Projects
High-quality QR Code generator library in Java, TypeScript/JavaScript, Python, Rust, C++, C.
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
qr code generator
Cross-browser QRCode generator for javascript
QR Code Generator implementation in JavaScript, Java and more.
Quick Overview
Libqrencode is a fast and compact C library for encoding data into QR Codes. It provides a simple API for generating QR Code symbols, supporting various output formats including PNG and SVG. The library is widely used in many applications and systems for generating QR Codes efficiently.
Pros
- Fast and efficient encoding of QR Codes
- Supports multiple output formats (PNG, SVG, ASCII, etc.)
- Well-documented API with examples
- Actively maintained with regular updates
Cons
- Limited to QR Code generation (no decoding capabilities)
- Requires additional dependencies for certain output formats (e.g., libpng for PNG output)
- C language may be less accessible for some developers compared to higher-level languages
Code Examples
- Basic QR Code generation:
#include <qrencode.h>
const char *text = "Hello, World!";
QRcode *qrcode = QRcode_encodeString(text, 0, QR_ECLEVEL_L, QR_MODE_8, 1);
// Use qrcode->data to access the generated QR Code
QRcode_free(qrcode);
- Generating a QR Code with custom size and error correction level:
#include <qrencode.h>
const char *text = "https://example.com";
QRcode *qrcode = QRcode_encodeString(text, 0, QR_ECLEVEL_H, QR_MODE_8, 3);
// qrcode->width will be 3 times larger than the default size
// Error correction level is set to the highest (H)
QRcode_free(qrcode);
- Saving QR Code as PNG image:
#include <qrencode.h>
#include <png.h>
const char *text = "QR Code Example";
QRcode *qrcode = QRcode_encodeString(text, 0, QR_ECLEVEL_M, QR_MODE_8, 1);
writePNG(qrcode->data, qrcode->width, "qrcode.png");
QRcode_free(qrcode);
// Note: writePNG function needs to be implemented separately using libpng
Getting Started
To use libqrencode in your project:
-
Install the library:
sudo apt-get install libqrencode-dev
-
Include the header in your C file:
#include <qrencode.h>
-
Compile your program with the library:
gcc your_program.c -lqrencode -o your_program
-
Use the API functions to generate QR Codes in your application.
Competitor Comparisons
High-quality QR Code generator library in Java, TypeScript/JavaScript, Python, Rust, C++, C.
Pros of QR-Code-generator
- Multi-language support: Implementations in Java, TypeScript/JavaScript, Python, C++, and C
- Extensive documentation and examples for each language implementation
- Supports a wide range of QR Code versions and error correction levels
Cons of QR-Code-generator
- Less mature project with fewer contributors and stars on GitHub
- Limited to QR Code generation only, without additional barcode types
Code Comparison
QR-Code-generator (Java):
QrCode qr = QrCode.encodeText("Hello, world!", QrCode.Ecc.MEDIUM);
BufferedImage img = qr.toImage(4, 10);
ImageIO.write(img, "png", new File("qr-code.png"));
libqrencode (C):
QRcode *qrcode = QRcode_encodeString("Hello, world!", 0, QR_ECLEVEL_M, QR_MODE_8, 1);
// Additional code required to generate image from the QRcode struct
Summary
QR-Code-generator offers multi-language support and extensive documentation, making it accessible for developers across different platforms. However, libqrencode is a more established project with a larger community and supports additional barcode types beyond QR codes. The choice between the two depends on specific project requirements and preferred programming language.
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
Pros of ZXing
- Multi-format support: Handles various barcode formats beyond QR codes
- Cross-platform compatibility: Available for Java, Android, and other platforms
- Active community and regular updates
Cons of ZXing
- Larger codebase and potentially higher resource usage
- Steeper learning curve due to broader functionality
- May be overkill for projects only requiring QR code generation
Code Comparison
ZXing (Java):
QRCodeWriter writer = new QRCodeWriter();
BitMatrix bitMatrix = writer.encode("Hello, World!", BarcodeFormat.QR_CODE, 200, 200);
libqrencode (C):
QRcode *qrcode = QRcode_encodeString("Hello, World!", 0, QR_ECLEVEL_L, QR_MODE_8, 1);
Key Differences
- ZXing offers a more comprehensive barcode solution, while libqrencode focuses specifically on QR codes
- libqrencode is written in C, making it potentially faster and more lightweight
- ZXing provides more extensive documentation and examples
- libqrencode may be easier to integrate into C/C++ projects
Use Cases
- Choose ZXing for projects requiring multiple barcode formats or cross-platform support
- Opt for libqrencode when focusing solely on QR codes or working with C/C++ applications prioritizing performance
A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
Pros of jsQR
- Written in JavaScript, making it easy to use in web applications without additional dependencies
- Can be run directly in the browser, enabling client-side QR code scanning
- Lightweight and easy to integrate into existing projects
Cons of jsQR
- Limited to QR code scanning; doesn't support generating QR codes
- May have lower performance compared to native implementations for large-scale processing
- Less extensive documentation and community support compared to libqrencode
Code Comparison
jsQR:
const code = jsQR(imageData.data, imageData.width, imageData.height);
if (code) {
console.log("Found QR code", code.data);
}
libqrencode:
QRcode *qrcode = QRcode_encodeString("Hello, World!", 0, QR_ECLEVEL_L, QR_MODE_8, 1);
if (qrcode != NULL) {
// Use the generated QR code
QRcode_free(qrcode);
}
Summary
jsQR is a JavaScript library focused on QR code scanning, ideal for web applications and client-side processing. libqrencode is a C library that primarily handles QR code generation, offering more extensive features and potentially better performance for server-side operations. The choice between them depends on the specific use case, with jsQR being more suitable for web-based scanning and libqrencode for robust QR code generation in various environments.
qr code generator
Pros of node-qrcode
- JavaScript-based, making it easily integrable into Node.js and browser environments
- Supports various output formats including PNG, SVG, and terminal output
- Offers a simple API with both promise-based and callback-style methods
Cons of node-qrcode
- May have slower performance for large-scale QR code generation compared to C-based libqrencode
- Potentially larger package size due to JavaScript dependencies
Code Comparison
node-qrcode:
const QRCode = require('qrcode')
QRCode.toDataURL('I am a pony!', (err, url) => {
console.log(url)
})
libqrencode:
#include <qrencode.h>
QRcode *qrcode = QRcode_encodeString("I am a pony!", 0, QR_ECLEVEL_L, QR_MODE_8, 1);
// Use the generated QR code
QRcode_free(qrcode);
Summary
node-qrcode is a JavaScript library for QR code generation, offering easy integration with web and Node.js projects. It supports multiple output formats and provides a user-friendly API. However, it may have performance limitations compared to the C-based libqrencode, which could be more suitable for high-performance or embedded systems. The choice between the two depends on the specific project requirements, development environment, and performance needs.
Cross-browser QRCode generator for javascript
Pros of qrcodejs
- Pure JavaScript implementation, no external dependencies
- Easy to use in web browsers without server-side processing
- Lightweight and suitable for client-side QR code generation
Cons of qrcodejs
- Limited to JavaScript environments
- May have performance limitations for generating large numbers of QR codes
- Less feature-rich compared to libqrencode
Code Comparison
qrcodejs:
var qrcode = new QRCode("qrcode", {
text: "http://example.com",
width: 128,
height: 128,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
libqrencode:
QRcode *qrcode;
unsigned char *data = (unsigned char *)"http://example.com";
qrcode = QRcode_encodeString((char *)data, 0, QR_ECLEVEL_H, QR_MODE_8, 1);
// Further processing required to render the QR code
The qrcodejs example demonstrates its simplicity for web use, generating and rendering a QR code with a single function call. The libqrencode example shows its C implementation, requiring additional steps for rendering but offering more low-level control and potential for integration in various environments.
QR Code Generator implementation in JavaScript, Java and more.
Pros of qrcode-generator
- Multi-language support: Implementations available in JavaScript, Java, and other languages
- Browser-friendly: Can be easily integrated into web applications
- Lightweight: Minimal dependencies and small codebase
Cons of qrcode-generator
- Limited features: Focuses primarily on QR code generation
- Less active maintenance: Fewer recent updates compared to libqrencode
- Limited documentation: Less comprehensive documentation and examples
Code Comparison
qrcode-generator (JavaScript):
var qr = qrcode(4, 'L');
qr.addData('Hello, World!');
qr.make();
var imgTag = qr.createImgTag(4);
libqrencode (C):
QRcode *qrcode = QRcode_encodeString("Hello, World!", 0, QR_ECLEVEL_L, QR_MODE_8, 1);
// Further processing to generate image
Both libraries offer straightforward ways to generate QR codes, but qrcode-generator provides a more web-friendly approach with its JavaScript implementation. libqrencode, being a C library, offers lower-level control and potentially better performance for native applications. The choice between the two depends on the specific project requirements, target platform, and desired level of control over the QR code generation process.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
libqrencode - a fast and compact QR Code encoding library
Attention: This repository contains the development version of libqrencode. See https://fukuchi.org/works/qrencode/ for the official stable releases. At this moment, the latest stable release is version 4.1.1.
GENERAL INFORMATION
Libqrencode is a fast and compact library for encoding data in a QR Code, a 2D symbology that can be scanned by handy terminals such as a smartphone. The capacity of QR Code is up to 7000 digits or 4000 characters and has high robustness.
Libqrencode accepts a string or a list of data chunks then encodes in a QR Code symbol as a bitmap array. While other QR Code applications generate an image file, using libqrencode allows applications to render QR Code symbols from raw bitmap data directly. This library also contains a command-line utility outputs QR Code images in various formats.
SPECIFICATION
Libqrencode supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Most of features in the specification are implemented such as:
- Numeric, alphabet, Japanese kanji (Shift-JIS) or any 8 bit code can be embedded
- Optimized encoding of a string
- Structured-append of symbols
- Micro QR Code (experimental)
Currently the following features are not supported:
- ECI and FNC1 mode
- QR Code model 1 (deprecated)
INSTALL
Requirements
While the command-line utility and some test programs use libpng or SDL 2.0, the libqrencode library itself has no dependencies. You can skip compiling tests and/or tools if you want not to install programs using SDL or PNG.
Compile & install
If there is no "configure" script in the source code directory, run "autogen.sh" at first to generate it - this is mandatory if you downloaded the source from GitHub. Some additional software is needed to complete this process. For example, in Ubuntu, the following packages are needed:
- autoconf
- automake
- autotools-dev
- libtool
- pkg-config
- libpng12-dev
You can skip this process if you have "configure" script already (typically when you downloaded the source tarball from fukuchi.org.)
Now you are ready to compile the library and tool. Type the following commands:
./configure
make
sudo make install
sudo ldconfig
This compiles and installs the library and header file to the appropriate directories: by default, /usr/local/lib and /usr/local/include. You can change the destination directory by passing some options to the configure script. Run "./configure --help" to see the list of options.
It also installs a command line tool "qrencode" to /usr/local/bin. If you want not to build it, give "--without-tools" option to the configure script.
If the configure script does not work well, try to use CMake.
cmake .
make
When you want to build the test programs, give "--with-tests" option to configure, or "-DWITH_TESTS=YES" to cmake.
Building libqrencode with vcpkg
You can download and install libqrencode using the vcpkg dependency manager:
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install libqrencode
The libqrencode port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request on the vcpkg repository.
USAGE
Basic usages of this library are written in the header file (qrencode.h). You can generate a manual of the library by using Doxygen, or see
https://fukuchi.org/works/qrencode/manual/index.html
WARNINGS
The library is distributed WITHOUT ANY WARRANTY.
Micro QR Code support is EXPERIMENTAL.
Be careful to use the command line tool (qrencode) if it is used by a web application (e.g. CGI script). For example, giving "-s" option with a large number to qrencode may cause DoS. The parameters should be checked by the application.
LICENSING INFORMATION
Copyright (C) 2006-2018 Kentaro Fukuchi
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
CONTACT
Visit the homepage at:
https://fukuchi.org/works/qrencode/
for new releases. The git repository is available at:
https://github.com/fukuchi/libqrencode
Please mail any bug reports, suggestions, comments, and questions to:
Kentaro Fukuchi kentaro@fukuchi.org
or submit issues to:
https://github.com/fukuchi/libqrencode/issues
ACKNOWLEDGMENTS
QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.
Reed-Solomon encoder included in this library is originally taken from FEC library developed by Phil Karn (KA9Q) and distributed under the terms of the GNU LGPL, then rewritten by Kentaro Fukuchi. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
- NANKI Haruo - improved lower-case characters encoding
- Katsumi Saito - SPEC file
- Philippe Delcroix - improved mask evaluation
- Yusuke Mihara - structured-append support
- David Dahl - DPI and SVG support patch
- Adam Shepherd - bug fix patch of the mask evaluation
- Josef Eisl (@zapster) - EPS support patch
- Colin (@moshen) - ANSI support patch
- Ralf Ertzinger - ASCII support patch
- Yutaka Niibe (@gniibe)- various bug fix patches
- Dan Storm (@Repox) - SVG support patch
- Lennart Poettering (@mezcalero) - improved text art patch
- Yann Droneaud - improved input validation patch
- Viona - bug fix patch for string splitting
- Daniel Dörrhöfer (@d4ndo) - RLE option, some bug fixes, Travis configuration
- Greg Hart - PNG32 support patch
- @siggi-heltau - bug fix patch
- Tobias Klauser (@tklauser) - bug fix patch, XPM support patch
- Robert Petersen (@ripetersen) - added ability to read input data from a file
- @Oblomov - improved SVG support patch
- MichaŠGórny (@mgorny) - reverse mappings of UTF8 and ANSIUTF8, build script fixes
- @EckoEdc - MinGW support patch
- Sebastian Buchwald (@UniQP) - Various code cleanups
- André Klitzing (@misery) - CMake support
- Alexey Nikolaev (@aleksey-nikolaev) - improved CMake support
- Vilppu Vuorinen (@vilppuvuorinen) - improved CMake support
- @vanillahsu - bug fix patch
- @Ation - bug fix patch
- Jonathan Bennett - Added "--inline" option to qrencode
- András Veres-Szentkirályi - ANSI256UTF8 support
- @sdf5 - improved CMake support
- Lonnie Abelbeck (@abelbeck) - bug fix patch
- @4061N - performance improvement patch
- Rosen Penev (@neheb) - CMake bug fix patch
- Mika Lindqvist (@mtl1979) - replacement for gettimeofday() for Windows.
- Shigeyuki Hirai, Paul Janssens, wangsai, Gavan Fantom, Matthew Baker, Rob Ryan, Fred Steinhaeuser, Terry Burton, @chisj, @vlad417, Petr, Hassan Hajji, Emmanuel Blot, ÃlúèÃhîp, Heiko Becker, Gavin Andresen, David Binderman, @ralgozino, Sean McMurray, Vlad Bespalov (@win32asm), Antenore Gatta, Yoshimichi Inoue, Sunil Maganally, Norman Gray, Danomi Manchego, @minus7, Ian Sweet, @qianchenglenger, Ronald Michaels, Yuji Ueno, Jakub Wilk, @KangLin, @c-273, @thebunnyrules, @NancyLi1013, Frédéric Wang, Dan Jacobson, Jan Tojnar, @xiaoyur347, @charmander - bug report / suggestion / typo fixes
Top Related Projects
High-quality QR Code generator library in Java, TypeScript/JavaScript, Python, Rust, C++, C.
ZXing ("Zebra Crossing") barcode scanning library for Java, Android
A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
qr code generator
Cross-browser QRCode generator for javascript
QR Code Generator implementation in JavaScript, Java and more.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot