• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

JuliaImages/QRCode.jl: Creating QR Codes within Julia

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

JuliaImages/QRCode.jl

开源软件地址:

https://github.com/JuliaImages/QRCode.jl

开源编程语言:

Julia 100.0%

开源软件介绍:

QRCode

Create QR Codes as data within Julia, or export as PNG.

Create a QR Code as data

Creating a QR Code couldn't be simpler.

julia> using QRCode

julia> qrcode("Hello world!")
29×29 BitArray{2}:
 false  false  false  falsefalse  false  false
 false  false  false  false     false  false  false
     ⋮                       ⋱
 false  false  false  false     false  false  false
 false  false  false  false     false  false  false

The value true represents a dark space and false a white square.

There are two optional arguments: the error correction level (explained below) and compact which, when true, removes the white space around the code.

julia> qrcode("Hello world!", High(), compact = true)
25×25 BitArray{2}:
 true   true   true   truetrue   true   true
 true  false  false  false     false  false   true
    ⋮                       ⋱
 true  false  false  false     false  false  false
 true   true   true   true     false  false   true

Export a QR Code as a PNG file

Exporting files is also easy.

julia> exportqrcode("Hello world!")

A file will be saved at ./qrcode.png.

QRCode1

There are three optional parameters.

julia> exportqrcode("Hello world!", "img/hello.png", Medium(), targetsize = 10, compact = true)

This file will be saved as ./img/hello.png (if the img directory already exists), have a size of (approximately) 10 centimeters and be compact. Please note that compact codes may be hard to read depending on their background.

QRCode2

Error Correction Level

QR Codes and be encoded with four error correction levels Low, Medium, Quartile and High. Error correction can restore missing data from the QR code.

  • Low can restore up to 7% of missing codewords.
  • Medium can restore up to 15% of missing codewords.
  • Quartile can restore up to 25% of missing codewords.
  • High can restore up to 30% of missing codewords.

The four levels are encoded as types in QRCode.jl, grouped under the abstract type ErrCorrLevel. Don't forget to use parentheses when you call the values: qrcode("Hello", High()).

Encoding Modes

QR Codes can encode data using several encoding schemes. QRCode.jl supports three of them: Numeric, Alphanumeric and Byte.

Numeric is used for messages composed of digits only, Alphanumeric for messages composed of digits, characters A-Z (capital only) space and % * + - . / : \$, and Bytes for messages composed of ISO 8859-1 or UTF-8 characters. Please not that QR Code reader don't always support arbitrary UTF-8 characters.

Acknowledgments

QRCode.jl was built following this excellent tutorial.

QRCode.jl was created during the Efficient Scientific Computing with Julia workshop, taught by Valentin Churavy at the Okinawa Institute of Science and Technology in July 2019. Slides available here.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
slyrz/CRF.jl: Conditional Random Fields in Julia发布时间:2022-07-09
下一篇:
juliabase/juliabase: Official source code repository of JuliaBase发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap