这个二维码成精了,加背景图就算了,连GIF都能搞
点击关注公众号,Java干货及时送达
开源最前线(ID:OpenSourceTop)猿妹整编
整理自:https://github.com/heuer/segno
平日里,我们看到的二维码是长这样的:
纯 Python 二维码生成器(支持 2.7、3.5+、PyPy2 和 PyPy3)
无依赖
支持多种序列化格式(SVG、PNG、EPS、PDF 等)
最快的(纯 Python)二维码编码器
汉字模式
命令行界面
简单、用户友好的 API
$ pip install segno
$ segno "Comfortably Numb"
$ segno -o=raincoat.svg "Famous Blue Raincoat"
$ segno --scale 10 --dark darkblue --border 0 --output=fire.svg "Who by Fire"
$ segno --scale 10 --light transparent --output=miracle.png "Waiting for the Miracle"
>>> import segno
>>> # Let Segno choose the minimal version and an optimal (maximal) error
>>> # level without changing the minimal version
>>> qrcode = segno.make('Up Jumped the Devil')
>>> qrcode.designator # Returns the QR code version and the error correction level
'2-Q'
>>> qrcode.save('up-jumped-the-devil.png') # Save as PNG
>>> qrcode.save('up-jumped-the-devil-2.png', scale=10) # Scaling factor 10
>>> qrcode.save('up-jumped-the-devil-3.png', light=None) # Transparent light modules
>>> qrcode.save('up-jumped-the-devil.pdf', scale=10) # Save as PDF
>>> # SVG drawing the dark modules in "dark blue"
>>> qrcode.save('up-jumped-the-devil.svg', scale=10, dark='darkblue')
>>> import segno
>>> qrcode = segno.make('RAIN')
>>> qrcode.is_micro
True
>>> qrcode.designator
'M2-M'
评论