You've already forked amazing-qr
mirror of
https://github.com/x-hw/amazing-qr.git
synced 2025-07-09 01:05:34 +02:00
3
.gitignore
vendored
3
.gitignore
vendored
@ -92,5 +92,6 @@ ENV/
|
|||||||
# Rope project settings
|
# Rope project settings
|
||||||
.ropeproject
|
.ropeproject
|
||||||
|
|
||||||
setup.py
|
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
|
||||||
|
.idea
|
||||||
|
156
README-cn.md
156
README-cn.md
@ -1,15 +1,7 @@
|
|||||||
# QR-Code
|
# Amazing-QR
|
||||||
[*back to English*](https://github.com/sylnsfar/qrcode/blob/master/README.md)
|
|
||||||
|
|
||||||
* **更新 (160906)**: 新增 **exe** 版本 - [myqr.exe in qrcode_win](https://github.com/sylnsfar/qrcode_win)
|
[*back to English*](https://github.com/hwxhw/amzqr/blob/master/README.md)
|
||||||
|
|
||||||
* **更新 (160908)**: 新增**网页**版本 - [amazing-qrcode](http://www.amazing-qrcode.com/) *(made by [Maras0830](https://github.com/Maras0830))*
|
|
||||||
|
|
||||||
* **更新 (160910)**: 发布到 **PyPI** - [**MyQR**](https://pypi.python.org/pypi/MyQR) !
|
|
||||||
|
|
||||||
* 160911: 更新为可导入的模块
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 概述
|
## 概述
|
||||||
|
|
||||||
@ -17,64 +9,38 @@
|
|||||||
|
|
||||||
可生成*普通二维码*、*带图片的艺术二维码(黑白与彩色)*、*动态二维码(黑白与彩色)*。
|
可生成*普通二维码*、*带图片的艺术二维码(黑白与彩色)*、*动态二维码(黑白与彩色)*。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Contents 目录
|
## Contents 目录
|
||||||
|
|
||||||
* [概述](#概述)
|
[toc]
|
||||||
* [目录](#目录)
|
|
||||||
* [示例](#示例)
|
|
||||||
* [安装](#安装)
|
|
||||||
* [使用方法](#使用方法)
|
|
||||||
* [命令行方式](#命令行方式)
|
|
||||||
* [作为导入文件](#作为导入文件)
|
|
||||||
* [使用提示](#使用提示)
|
|
||||||
* [可用字符](#可用字符)
|
|
||||||
* [依赖库](#依赖库)
|
|
||||||
* [运行环境](#运行环境)
|
|
||||||
* [协议](#协议)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 示例
|
## 示例
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# 通过 pip
|
pip install amzqr
|
||||||
pip(3) install myqr(or MyQR)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 使用方法
|
## 使用方法
|
||||||
|
|
||||||
### 命令行方式
|
### 命令行方式
|
||||||
|
|
||||||
*(**提示**:如果你尚未安装 [**MyQR**](https://pypi.python.org/pypi/MyQR) ,以下内容请使用`python(3) myqr.py` 而非`myqr` 。)*
|
*(**提示**:如果你尚未安装 [**amzqr**](https://pypi.python.org/pypi/amzqr) ,以下内容请使用`python(3) amzqr.py` 而非`amzqr` 。)*
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# 概括
|
# 概括
|
||||||
myqr Words
|
amzqr Words
|
||||||
[-v {1,2,3,...,40}]
|
[-v {1,2,3,...,40}]
|
||||||
[-l {L,M,Q,H}]
|
[-l {L,M,Q,H}]
|
||||||
[-n output-filename]
|
[-n output-filename]
|
||||||
@ -89,26 +55,20 @@ myqr Words
|
|||||||
- [艺术二维码](#艺术二维码) 介绍了 `-p`, `-c`, `-con`, `-bri`
|
- [艺术二维码](#艺术二维码) 介绍了 `-p`, `-c`, `-con`, `-bri`
|
||||||
- [动态GIF二维码](#动态gif二维码) 介绍了动态的生成方法和注意点
|
- [动态GIF二维码](#动态gif二维码) 介绍了动态的生成方法和注意点
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 普通二维码
|
#### 普通二维码
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#1 Words
|
#1 Words
|
||||||
myqr https://github.com
|
amzqr https://github.com
|
||||||
```
|
```
|
||||||
|
|
||||||
* 在命令后输入链接或者句子作为参数,然后在程序的当前目录中产生相应的二维码图片文件,默认命名为” qrcode.png“。
|
* 在命令后输入链接或者句子作为参数,然后在程序的当前目录中产生相应的二维码图片文件,默认命名为” qrcode.png“。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#2 -v, -l
|
#2 -v, -l
|
||||||
myqr https://github.com -v 10 -l Q
|
amzqr https://github.com -v 10 -l Q
|
||||||
```
|
```
|
||||||
|
|
||||||
* **默认边长**是取决于你输入的信息的长度和使用的纠错等级;
|
* **默认边长**是取决于你输入的信息的长度和使用的纠错等级;
|
||||||
@ -121,12 +81,9 @@ myqr https://github.com -v 10 -l Q
|
|||||||
|
|
||||||
`-l` 控制纠错水平,范围是**L、M、Q、H**,从左到右依次升高。
|
`-l` 控制纠错水平,范围是**L、M、Q、H**,从左到右依次升高。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#3 -n, -d
|
#3 -n, -d
|
||||||
myqr https://github.com -n github_qr.jpg -d .../paths/
|
amzqr https://github.com -n github_qr.jpg -d .../paths/
|
||||||
```
|
```
|
||||||
|
|
||||||
- **默认输出文件名**是“ qrcode.png ",而**默认存储位置**是当前目录。
|
- **默认输出文件名**是“ qrcode.png ",而**默认存储位置**是当前目录。
|
||||||
@ -137,67 +94,45 @@ myqr https://github.com -n github_qr.jpg -d .../paths/
|
|||||||
|
|
||||||
`-d` 控制位置。
|
`-d` 控制位置。
|
||||||
|
|
||||||
|
#### 艺术二维码
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 艺术二维码
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#1 -p
|
#1 -p
|
||||||
myqr https://github.com -p github.jpg
|
amzqr https://github.com -p github.jpg
|
||||||
```
|
```
|
||||||
|
|
||||||
* 参数`-p` 用来将QR二维码图像与一张同目录下的图片相结合,产生一张**黑白**图片。
|
* 参数`-p` 用来将QR二维码图像与一张同目录下的图片相结合,产生一张**黑白**图片。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#2 -c
|
#2 -c
|
||||||
myqr https://github.com -p github.jpg -c
|
amzqr https://github.com -p github.jpg -c
|
||||||
```
|
```
|
||||||
|
|
||||||
* 加上参数 `-c` 可以使产生的图片由黑白变为**彩色**的。
|
* 加上参数 `-c` 可以使产生的图片由黑白变为**彩色**的。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#3 -con, -bri
|
#3 -con, -bri
|
||||||
myqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6
|
amzqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6
|
||||||
```
|
```
|
||||||
|
|
||||||
* 参数`-con` 用以调节图片的**对比度**,1.0 表示原始图片,更小的值表示更低对比度,更大反之。**默认为1.0**。
|
* 参数`-con` 用以调节图片的**对比度**,1.0 表示原始图片,更小的值表示更低对比度,更大反之。**默认为1.0**。
|
||||||
|
|
||||||
* 参数 `-bri` 用来调节图片的**亮度**,其余用法和取值与 `-con` 相同。
|
* 参数 `-bri` 用来调节图片的**亮度**,其余用法和取值与 `-con` 相同。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 动态GIF二维码
|
#### 动态GIF二维码
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
动态二维码与上述的带图片的二维码的生成方法没什么区别,你只要采用 `.gif` 格式的图片即可生成黑白或者彩色的动态二维码。但**注意**如果使用了 `-n` 参数自定义输出的文件名,切记其格式也必须是 `.gif` 格式。
|
动态二维码与上述的带图片的二维码的生成方法没什么区别,你只要采用 `.gif` 格式的图片即可生成黑白或者彩色的动态二维码。但**注意**如果使用了 `-n` 参数自定义输出的文件名,切记其格式也必须是 `.gif` 格式。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 作为导入文件
|
### 作为导入文件
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# 安装模块后
|
# 安装模块后
|
||||||
from MyQR import myqr
|
from amzqr import amzqr
|
||||||
version, level, qr_name = myqr.run(
|
version, level, qr_name = amzqr.run(
|
||||||
words,
|
words,
|
||||||
version=1,
|
version=1,
|
||||||
level='H',
|
level='H',
|
||||||
@ -207,16 +142,13 @@ version, level, qr_name = myqr.run(
|
|||||||
brightness=1.0,
|
brightness=1.0,
|
||||||
save_name=None,
|
save_name=None,
|
||||||
save_dir=os.getcwd()
|
save_dir=os.getcwd()
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*以下各个参数已经在[上文](#命令行方式)有所介绍*
|
*以下各个参数已经在[上文](#命令行方式)有所介绍*
|
||||||
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# help(myqr)
|
# help(amzqr)
|
||||||
Positional parameter
|
Positional parameter
|
||||||
words: str
|
words: str
|
||||||
|
|
||||||
@ -230,23 +162,15 @@ Optional parameters
|
|||||||
save_name: str, the output filename like 'example.png'
|
save_name: str, the output filename like 'example.png'
|
||||||
save_dir: str, the output directory
|
save_dir: str, the output directory
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 使用提示
|
## 使用提示
|
||||||
|
|
||||||
* 请采用**正方形**或近似正方形的图片
|
* 请采用**正方形**或近似正方形的图片
|
||||||
|
|
||||||
* 建议在图片尺寸大的时候使用 `-v` 的值也应该**适当**变大。
|
* 建议在图片尺寸大的时候使用 `-v` 的值也应该**适当**变大。
|
||||||
|
|
||||||
* 如果图片有透明无色部分,最终效果是:
|
* 如果图片有透明无色部分,最终效果是:
|
||||||
|
|
||||||
你可以将透明部分修改成白色,最终效果会变成
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
你可以将透明部分修改成白色,最终效果会变成
|
||||||
|
|
||||||
## 可用字符
|
## 可用字符
|
||||||
|
|
||||||
@ -260,31 +184,9 @@ Optional parameters
|
|||||||
· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
|
· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 环境
|
||||||
|
|
||||||
|
- Python 3
|
||||||
|
|
||||||
## 依赖库
|
|
||||||
|
|
||||||
* [pillow](https://pypi.python.org/pypi/Pillow/3.3.1)
|
|
||||||
* [numpy](https://pypi.python.org/pypi/numpy)
|
|
||||||
* [imageio](https://pypi.python.org/pypi/imageio)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*(**提示**:如果没有安装 [**MyQR**](https://pypi.python.org/pypi/MyQR) ,使用命令`pip install -r requirements.txt` 来安装所有依赖的库。)*
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 运行环境
|
|
||||||
|
|
||||||
* Linux, Python 3
|
|
||||||
* Windows, Python 3
|
|
||||||
* Mac, Python 3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 协议
|
## 协议
|
||||||
|
|
||||||
|
141
README.md
141
README.md
@ -1,79 +1,45 @@
|
|||||||
# QR-Code
|
# Amazing-QR
|
||||||
[*转到中文版*](https://github.com/sylnsfar/qrcode/blob/master/README-cn.md)
|
|
||||||
|
|
||||||
* **update (160906)**: added an **exe** version - [myqr.exe in qrcode_win](https://github.com/sylnsfar/qrcode_win)
|
[*转到中文版*](https://github.com/hwxhw/amzqr/blob/master/README-cn.md)
|
||||||
|
|
||||||
* **update (160908)**: added a **web** version - [amazing-qrcode](http://www.amazing-qrcode.com/) *(made by [Maras0830](https://github.com/Maras0830))*
|
|
||||||
|
|
||||||
* **update (160910)**: distributed to **PyPI** - [**MyQR**](https://pypi.python.org/pypi/MyQR) !
|
|
||||||
|
|
||||||
* 160911: updated to be importable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
|
|
||||||
**Python QR Code Generator**
|
**Python QR Code Generator**
|
||||||
|
|
||||||
Generate *common qr-code*, *artistic qr-code (black & white or colorized)*, *animated qr-code (black & white or colorized)*.
|
Generate *common qr-code*, *artistic qr-code (black & white or colorized)*, *animated qr-code (black & white or colorized)*.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Contents
|
## Contents
|
||||||
|
|
||||||
* [Overview](#overview)
|
[toc]
|
||||||
* [Contents](#contents)
|
|
||||||
* [Examples](#examples)
|
|
||||||
* [Install](#install)
|
|
||||||
* [Usage](#usage)
|
|
||||||
* [Terminal Way](#terminal-way)
|
|
||||||
* [Import Way](#import-way)
|
|
||||||
* [Tips](#tips)
|
|
||||||
* [Supported Characters](#supported-characters)
|
|
||||||
* [Dependencies](#dependencies)
|
|
||||||
* [Environment](#environment)
|
|
||||||
* [License](#license)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# via pip
|
# via pip
|
||||||
pip(3) install myqr(or MyQR)
|
pip install amzqr
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Terminal Way
|
### Terminal Way
|
||||||
|
|
||||||
*(**TIPS**: If you haven't install [**MyQR**](https://pypi.python.org/pypi/MyQR), you should `python(3) myqr.py` instead of `myqr` blow.)*
|
*(**TIPS**: If you haven't install [**amzqr**](https://pypi.python.org/pypi/amzqr), you should `python(3) amzqr.py` instead of `amzqr` blow.)*
|
||||||
|
|
||||||
```python
|
```sh
|
||||||
# summary
|
# summary
|
||||||
myqr Words
|
amzqr Words
|
||||||
[-v {1,2,3,...,40}]
|
[-v {1,2,3,...,40}]
|
||||||
[-l {L,M,Q,H}]
|
[-l {L,M,Q,H}]
|
||||||
[-n output-filename]
|
[-n output-filename]
|
||||||
@ -88,26 +54,21 @@ myqr Words
|
|||||||
- see [Artistic QR-Code](#artistic-qr-code) for `-p`, `-c`, `-con`, `-bri`
|
- see [Artistic QR-Code](#artistic-qr-code) for `-p`, `-c`, `-con`, `-bri`
|
||||||
- see [Animated GIF QR-Code](#animated-gif-qr-code) about GIF
|
- see [Animated GIF QR-Code](#animated-gif-qr-code) about GIF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Common QR-Code
|
#### Common QR-Code
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#1 Words
|
#1 Words
|
||||||
myqr https://github.com
|
amzqr https://github.com
|
||||||
```
|
```
|
||||||
|
|
||||||
* Just input a URL or a sentence, then get your QR-Code named 'qrcode.png' in the current directory.
|
* Just input a URL or a sentence, then get your QR-Code named 'qrcode.png' in the current directory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#2 -v, -l
|
#2 -v, -l
|
||||||
myqr https://github.com -v 10 -l Q
|
amzqr https://github.com -v 10 -l Q
|
||||||
```
|
```
|
||||||
|
|
||||||
* The **default** size of QR-Code depends both on the numbers of words you input and the level, while the **default** level (Error Correction Level) is **H** (the highest).
|
* The **default** size of QR-Code depends both on the numbers of words you input and the level, while the **default** level (Error Correction Level) is **H** (the highest).
|
||||||
@ -123,7 +84,7 @@ myqr https://github.com -v 10 -l Q
|
|||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#3 -n, -d
|
#3 -n, -d
|
||||||
myqr https://github.com -n github_qr.jpg -d .../paths/
|
amzqr https://github.com -n github_qr.jpg -d .../paths/
|
||||||
```
|
```
|
||||||
|
|
||||||
* The **default** output-filename is 'qrcode.png', while the **default** output-directory is current directory.
|
* The **default** output-filename is 'qrcode.png', while the **default** output-directory is current directory.
|
||||||
@ -135,40 +96,31 @@ myqr https://github.com -n github_qr.jpg -d .../paths/
|
|||||||
`-d` means directory.
|
`-d` means directory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Artistic QR-Code
|
#### Artistic QR-Code
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#1 -p
|
#1 -p
|
||||||
myqr https://github.com -p github.jpg
|
amzqr https://github.com -p github.jpg
|
||||||
```
|
```
|
||||||
|
|
||||||
* The `-p` is to combine the QR-Code with the following picture which is in the same directory as the program. The resulting picture is **black and white** by default.
|
* The `-p` is to combine the QR-Code with the following picture which is in the same directory as the program. The resulting picture is **black and white** by default.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#2 -c
|
#2 -c
|
||||||
myqr https://github.com -p github.jpg -c
|
amzqr https://github.com -p github.jpg -c
|
||||||
```
|
```
|
||||||
|
|
||||||
* The `-c` is to make the resulting picture **colorized**.
|
* The `-c` is to make the resulting picture **colorized**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
#3 -con, -bri
|
#3 -con, -bri
|
||||||
myqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6
|
amzqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6
|
||||||
```
|
```
|
||||||
|
|
||||||
* The `-con` flag changes the **contrast** of the picture - a low number corresponds to low contrast and a high number to high contrast. **Default: 1.0**.
|
* The `-con` flag changes the **contrast** of the picture - a low number corresponds to low contrast and a high number to high contrast. **Default: 1.0**.
|
||||||
@ -181,18 +133,16 @@ myqr https://github.com -p github.jpg [-c] -con 1.5 -bri 1.6
|
|||||||
|
|
||||||
#### Animated GIF QR-Code
|
#### Animated GIF QR-Code
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The only difference from Artistic QR-Code mentioned above is that you should input an image file in the `.gif` format. The you can get your black-and-white or colorful qr-code. Remember that when you use `-n` to customize the output-filename, then the output-filename must end by `.gif`.
|
The only difference from Artistic QR-Code mentioned above is that you should input an image file in the `.gif` format. The you can get your black-and-white or colorful qr-code. Remember that when you use `-n` to customize the output-filename, then the output-filename must end by `.gif`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Import Way
|
### Import Way
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# after installation
|
from amzqr import amzqr
|
||||||
from MyQR import myqr
|
|
||||||
version, level, qr_name = myqr.run(
|
version, level, qr_name = amzqr.run(
|
||||||
words,
|
words,
|
||||||
version=1,
|
version=1,
|
||||||
level='H',
|
level='H',
|
||||||
@ -202,7 +152,7 @@ version, level, qr_name = myqr.run(
|
|||||||
brightness=1.0,
|
brightness=1.0,
|
||||||
save_name=None,
|
save_name=None,
|
||||||
save_dir=os.getcwd()
|
save_dir=os.getcwd()
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -210,7 +160,7 @@ version, level, qr_name = myqr.run(
|
|||||||
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# help(myqr)
|
# help(amzqr)
|
||||||
Positional parameter
|
Positional parameter
|
||||||
words: str
|
words: str
|
||||||
|
|
||||||
@ -225,26 +175,15 @@ Optional parameters
|
|||||||
save_dir: str, the output directory
|
save_dir: str, the output directory
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
* Use a nearly **square** picture instead of a rectangle one.
|
* Use a nearly **square** picture instead of a rectangle one.
|
||||||
|
|
||||||
* If the size of the picture is large, you should also choose a **rightly** large `-v` instead of using the default one.
|
* If the size of the picture is large, you should also choose a **rightly** large `-v` instead of using the default one.
|
||||||
|
|
||||||
* If part of the picture is transparent, the qr code will look like: 
|
* If part of the picture is transparent, the qr code will look like: 
|
||||||
|
|
||||||
You can change the transparent layer to white, and then it will look like: 
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You can change the transparent layer to white, and then it will look like: 
|
||||||
|
|
||||||
## Supported Characters
|
## Supported Characters
|
||||||
|
|
||||||
@ -258,31 +197,9 @@ Optional parameters
|
|||||||
· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
|
· , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and (space)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
* [pillow](https://pypi.python.org/pypi/Pillow/3.3.1)
|
|
||||||
* [numpy](https://pypi.python.org/pypi/numpy)
|
|
||||||
* [imageio](https://pypi.python.org/pypi/imageio)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*(**TIPS**: Without a installed [**MyQR**](https://pypi.python.org/pypi/MyQR), you should use `pip install -r requirements.txt` to ensure you have all dependencies.)*
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Environment
|
## Environment
|
||||||
|
|
||||||
* Linux, Python 3
|
- Python 3
|
||||||
* Windows, Python 3
|
|
||||||
* Mac, Python 3
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
7
amzqr.py
Normal file
7
amzqr.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# To be used just when amzqr is not installed
|
||||||
|
|
||||||
|
from amzqr.terminal import main
|
||||||
|
|
||||||
|
main()
|
0
MyQR/__init__.py → amzqr/__init__.py
Normal file → Executable file
0
MyQR/__init__.py → amzqr/__init__.py
Normal file → Executable file
6
MyQR/myqr.py → amzqr/amzqr.py
Normal file → Executable file
6
MyQR/myqr.py → amzqr/amzqr.py
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from MyQR.mylibs import theqrmodule
|
from amzqr.mylibs import theqrmodule
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# Positional parameters
|
# Positional parameters
|
||||||
@ -18,7 +18,7 @@ from PIL import Image
|
|||||||
# save_name: str, the output filename like 'example.png'
|
# save_name: str, the output filename like 'example.png'
|
||||||
# save_dir: str, the output directory
|
# save_dir: str, the output directory
|
||||||
#
|
#
|
||||||
# See [https://github.com/sylnsfar/qrcode] for more details!
|
# See [https://github.com/hwxhw/amazing-qr] for more details!
|
||||||
def run(words, version=1, level='H', picture=None, colorized=False, contrast=1.0, brightness=1.0, save_name=None, save_dir=os.getcwd()):
|
def run(words, version=1, level='H', picture=None, colorized=False, contrast=1.0, brightness=1.0, save_name=None, save_dir=os.getcwd()):
|
||||||
|
|
||||||
supported_chars = r"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ··,.:;+-*/\~!@#$%^&`'=<>[]()?_{}|"
|
supported_chars = r"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ··,.:;+-*/\~!@#$%^&`'=<>[]()?_{}|"
|
||||||
@ -49,7 +49,7 @@ def run(words, version=1, level='H', picture=None, colorized=False, contrast=1.0
|
|||||||
|
|
||||||
|
|
||||||
def combine(ver, qr_name, bg_name, colorized, contrast, brightness, save_dir, save_name=None):
|
def combine(ver, qr_name, bg_name, colorized, contrast, brightness, save_dir, save_name=None):
|
||||||
from MyQR.mylibs.constant import alig_location
|
from amzqr.mylibs.constant import alig_location
|
||||||
from PIL import ImageEnhance, ImageFilter
|
from PIL import ImageEnhance, ImageFilter
|
||||||
|
|
||||||
qr = Image.open(qr_name)
|
qr = Image.open(qr_name)
|
2
MyQR/mylibs/ECC.py → amzqr/mylibs/ECC.py
Normal file → Executable file
2
MyQR/mylibs/ECC.py → amzqr/mylibs/ECC.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
|
from amzqr.mylibs.constant import GP_list, ecc_num_per_block, lindex, po2, log
|
||||||
|
|
||||||
#ecc: Error Correction Codewords
|
#ecc: Error Correction Codewords
|
||||||
def encode(ver, ecl, data_codewords):
|
def encode(ver, ecl, data_codewords):
|
0
MyQR/mylibs/__init__.py → amzqr/mylibs/__init__.py
Normal file → Executable file
0
MyQR/mylibs/__init__.py → amzqr/mylibs/__init__.py
Normal file → Executable file
0
MyQR/mylibs/constant.py → amzqr/mylibs/constant.py
Normal file → Executable file
0
MyQR/mylibs/constant.py → amzqr/mylibs/constant.py
Normal file → Executable file
2
MyQR/mylibs/data.py → amzqr/mylibs/data.py
Normal file → Executable file
2
MyQR/mylibs/data.py → amzqr/mylibs/data.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
|
from amzqr.mylibs.constant import char_cap, required_bytes, mindex, lindex, num_list, alphanum_list, grouping_list, mode_indicator
|
||||||
|
|
||||||
# ecl: Error Correction Level(L,M,Q,H)
|
# ecl: Error Correction Level(L,M,Q,H)
|
||||||
def encode(ver, ecl, str):
|
def encode(ver, ecl, str):
|
0
MyQR/mylibs/draw.py → amzqr/mylibs/draw.py
Normal file → Executable file
0
MyQR/mylibs/draw.py → amzqr/mylibs/draw.py
Normal file → Executable file
2
MyQR/mylibs/matrix.py → amzqr/mylibs/matrix.py
Normal file → Executable file
2
MyQR/mylibs/matrix.py → amzqr/mylibs/matrix.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.mylibs.constant import alig_location, format_info_str, version_info_str, lindex
|
from amzqr.mylibs.constant import alig_location, format_info_str, version_info_str, lindex
|
||||||
|
|
||||||
def get_qrmatrix(ver, ecl, bits):
|
def get_qrmatrix(ver, ecl, bits):
|
||||||
num = (ver - 1) * 4 + 21
|
num = (ver - 1) * 4 + 21
|
2
MyQR/mylibs/structure.py → amzqr/mylibs/structure.py
Normal file → Executable file
2
MyQR/mylibs/structure.py → amzqr/mylibs/structure.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.mylibs.constant import required_remainder_bits, lindex, grouping_list
|
from amzqr.mylibs.constant import required_remainder_bits, lindex, grouping_list
|
||||||
|
|
||||||
def structure_final_bits(ver, ecl, data_codewords, ecc):
|
def structure_final_bits(ver, ecl, data_codewords, ecc):
|
||||||
final_message = interleave_dc(ver, ecl, data_codewords) + interleave_ecc(ecc)
|
final_message = interleave_dc(ver, ecl, data_codewords) + interleave_ecc(ecc)
|
2
MyQR/mylibs/theqrmodule.py → amzqr/mylibs/theqrmodule.py
Normal file → Executable file
2
MyQR/mylibs/theqrmodule.py → amzqr/mylibs/theqrmodule.py
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.mylibs import data, ECC, structure, matrix, draw
|
from amzqr.mylibs import data, ECC, structure, matrix, draw
|
||||||
|
|
||||||
# ver: Version from 1 to 40
|
# ver: Version from 1 to 40
|
||||||
# ecl: Error Correction Level (L,M,Q,H)
|
# ecl: Error Correction Level (L,M,Q,H)
|
2
MyQR/terminal.py → amzqr/terminal.py
Normal file → Executable file
2
MyQR/terminal.py → amzqr/terminal.py
Normal file → Executable file
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from MyQR.myqr import run
|
from amzqr.amzqr import run
|
||||||
import os
|
import os
|
||||||
|
|
||||||
def main():
|
def main():
|
7
myqr.py
7
myqr.py
@ -1,7 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
# To be used just when MyQR is not installed
|
|
||||||
|
|
||||||
from MyQR.terminal import main
|
|
||||||
|
|
||||||
main()
|
|
41
setup.py
Normal file
41
setup.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
with open("README.md", "r", encoding="utf-8") as fh:
|
||||||
|
long_description = fh.read()
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
name='amzqr',
|
||||||
|
version='0.0.1',
|
||||||
|
keywords='qr qrcode amazing artistic animated gif colorized',
|
||||||
|
description='Generater for amazing QR Codes. Including Common, Artistic and Animated QR Codes.',
|
||||||
|
long_description=long_description,
|
||||||
|
long_description_content_type="text/markdown",
|
||||||
|
author='hw',
|
||||||
|
author_email='xhaowen.xu@gmail.com',
|
||||||
|
url='https://github.com/hwxhw/amazing-qr',
|
||||||
|
download_url='https://github.com/hwxhw/amazing-qr',
|
||||||
|
project_urls={
|
||||||
|
"Bug Tracker": "https://github.com/hwxhw/amazing-qr/issues",
|
||||||
|
},
|
||||||
|
install_requires=[
|
||||||
|
'imageio >= 1.5',
|
||||||
|
'numpy >= 1.11.1',
|
||||||
|
'Pillow>=3.3.1'
|
||||||
|
],
|
||||||
|
packages=['amzqr', 'amzqr.mylibs'],
|
||||||
|
license='GPLv3',
|
||||||
|
classifiers=[
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Operating System :: MacOS',
|
||||||
|
'Operating System :: POSIX :: Linux',
|
||||||
|
'Operating System :: Microsoft :: Windows',
|
||||||
|
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)'
|
||||||
|
],
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'amzqr=amzqr.terminal:main',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
python_requires=">=3",
|
||||||
|
)
|
Reference in New Issue
Block a user