彩色二维码 还有 Micro QR 码 以及艺术二维码 (需要qrcode-artistic插件) Segno安装方法很简单,可以直接使用pip从PyPI安装:
$ pip install segno
接下来,可以直接使用命令行脚本将二维码输出:
$ segno "Comfortably Numb"
要序列化二维码,可以直接使用“output”参数如下:
$ 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')