Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

舅舅孩子,请问在Pycharm上怎样跑啊,太懵了 #84

Open
kkkkkkkkevin opened this issue May 19, 2021 · 5 comments
Open

舅舅孩子,请问在Pycharm上怎样跑啊,太懵了 #84

kkkkkkkkevin opened this issue May 19, 2021 · 5 comments

Comments

@kkkkkkkkevin
Copy link

kkkkkkkkevin commented May 19, 2021

import way 太劝退新手了,给点提示都行

@shijianzugouniai
Copy link

你跑起来了吗?我跑起来了,也许可以一起交流

@biuhe
Copy link

biuhe commented Nov 1, 2023

我写了个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

@cys138138
Copy link

cys138138 commented Nov 1, 2023 via email

@zhangtinghai
Copy link

zhangtinghai commented Nov 1, 2023 via email

@kuaij
Copy link

kuaij commented Nov 1, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants