QR Code Tips

Scanning QR Codes

Quirc

The demo tools from the Quirc library can be used to scan QR Codes with a built in camera.

The demo tools can be built on macOS using MacPorts:

  1. Install the required packages:

    $ sudo port install gmake libsdl jpeg libsdl_gfx opencv4-devel
    

    Note that this also installs libquirc as a dependency of opencv4-devel, but this port does not include the demo applications that we want.

  2. Set environment variables for the build:

    $ export PKG_CONFIG_PATH=/opt/local/lib/opencv4/pkgconfig
    $ export CFLAGS='-I/opt/local/include'
    $ export LDFLAGS='-L/opt/local/lib'
    
  3. Build the library:

    $ gmake
    
  4. Build quirc-demo-opencv:

    $ gmake quirc-demo-opencv
    
  5. Build inspect-opencv:

    $ gmake inspect-opencv
    
  6. Build inspect:

    $ gmake inspect
    

See the README.me file for usage.

zbar

The zbar Bar Code Reader can also be used to read QR Codes. It is available on MacPorts as the zbar port.

$ sudo port install zbar

There are variants for this port. port variants zbar will list them.

See the zbar README.md for usage instructions.

Encoding QR Codes

libqrencode provides a command line utility, qrencode to easily create QR Codes. Install on MacPorts with:

$ sudo port install qrencode

Common QR Code Formats

See also https://github.com/zxing/zxing/wiki/Barcode-Contents for a list of commonly used formats.


-- Frank Dean - 22 Jul 2023

Related Topics: OneTimePasswords