Comments (5)
你跑起来了吗?我跑起来了,也许可以一起交流
from amazing-qr.
我写了个python工具类可以参考使用
import os
# 安装模块后
from amzqr import amzqr
class QrcodeUtil:
@staticmethod
def save_img(words: str = '', level: str = 'H', picture_path: str = None, colorized: bool = False,
save_name: str = 'qrcode.png', save_path: str = os.getcwd()):
"""
生成二维码
doc: https://github.com/x-hw/amazing-qr/blob/master/README-cn.md
:param words: 要生成的文字内容
:param level: 控制纠错水平,范围是L、M、Q、H,从左到右依次升高
:param picture_path: 用来将QR二维码图像与一张同目录下的图片相结合,产生一张黑白图片
:param colorized: 可以使产生的图片由黑白变为彩色的
:param save_name: 保存的文件名,格式可以是 .jpg, .png ,.bmp ,.gif , 如果输入图片picture_path 是 gif 则输出格式也要 .gif
:param save_path: 保存路径,默认存储位置是当前目录
"""
# 如果输入的保存名称包含后缀,则截取掉后缀
index = save_name.rfind(".")
if index != -1:
save_name = save_name[:index]
# 如果有引入图片则判断是否为 .gif 动图,是则修改保存名称后缀,否则统一输出 png 格式
if picture_path and picture_path.endswith(".gif"):
suffix = '.gif'
else:
suffix = '.png'
version, level, qr_name = amzqr.run(
words=words,
version=1,
level=level,
picture=picture_path,
colorized=colorized,
contrast=1.0,
brightness=1.0,
save_name=save_name + suffix,
save_dir=save_path
)
return version, level, qr_name
from amazing-qr.
from amazing-qr.
from amazing-qr.
from amazing-qr.
Related Issues (20)
- how can i suppress terminal/operations results? HOT 3
- Qrs HOT 3
- niubility !!
- line 16: mode: alphanumeric error. HOT 3
- SVG format support for improved quality & scalability
- How can i get return of the qr code image on python?
- No process is on the other end of the pipe HOT 2
- AttributeError: 'NoneType' object has no attribute 'palette' HOT 5
- problem when i try to make qrcode for ussd
- myqr is showing not found in window command HOT 1
- Cannot give multi line input? HOT 2
- Generate image in memory without need to save it to disk HOT 1
- [FR] Add ASCII text output mode HOT 1
- url不支持包含&字符 HOT 4
- Does not work if the link to the site contains the = sign HOT 1
- Feature request: Add text field on QR code HOT 1
- Homebrew package HOT 2
- vcard support
- 动态二维码生成问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazing-qr.