qrcode-pretty 1.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qrcode_pretty/__init__.py +13 -0
- qrcode_pretty/const.py +42 -0
- qrcode_pretty/entrypoint.py +139 -0
- qrcode_pretty/qr_code_generator.py +309 -0
- qrcode_pretty-1.0.3.dist-info/METADATA +330 -0
- qrcode_pretty-1.0.3.dist-info/RECORD +9 -0
- qrcode_pretty-1.0.3.dist-info/WHEEL +4 -0
- qrcode_pretty-1.0.3.dist-info/entry_points.txt +2 -0
- qrcode_pretty-1.0.3.dist-info/licenses/LICENSE +103 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Pretty QR Code - Generate beautiful, customizable QR codes."""
|
|
2
|
+
|
|
3
|
+
__version__ = "1.0.0"
|
|
4
|
+
|
|
5
|
+
from .qr_code_generator import make_qrcode, make_qrcode_svg
|
|
6
|
+
from .const import DRAWER_CLASSES, ERROR_CORRECTION_LEVELS
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"make_qrcode",
|
|
10
|
+
"make_qrcode_svg",
|
|
11
|
+
"DRAWER_CLASSES",
|
|
12
|
+
"ERROR_CORRECTION_LEVELS",
|
|
13
|
+
]
|
qrcode_pretty/const.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
from qrcode.image.styles.moduledrawers.pil import (
|
|
4
|
+
SquareModuleDrawer,
|
|
5
|
+
GappedSquareModuleDrawer,
|
|
6
|
+
CircleModuleDrawer,
|
|
7
|
+
RoundedModuleDrawer,
|
|
8
|
+
VerticalBarsDrawer,
|
|
9
|
+
HorizontalBarsDrawer
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from qrcode.constants import (
|
|
13
|
+
ERROR_CORRECT_L,
|
|
14
|
+
ERROR_CORRECT_M,
|
|
15
|
+
ERROR_CORRECT_Q,
|
|
16
|
+
ERROR_CORRECT_H
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
ALLOWED_STYLES = {
|
|
20
|
+
"square",
|
|
21
|
+
"gapped-square",
|
|
22
|
+
"circle",
|
|
23
|
+
"round",
|
|
24
|
+
"vertical-bars",
|
|
25
|
+
"horizontal-bars"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
DRAWER_CLASSES = {
|
|
29
|
+
"square": SquareModuleDrawer,
|
|
30
|
+
"gapped-square": GappedSquareModuleDrawer,
|
|
31
|
+
"circle": CircleModuleDrawer,
|
|
32
|
+
"round": RoundedModuleDrawer,
|
|
33
|
+
"vertical-bars": VerticalBarsDrawer,
|
|
34
|
+
"horizontal-bars": HorizontalBarsDrawer,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ERROR_CORRECTION_LEVELS = {
|
|
38
|
+
"L": ERROR_CORRECT_L,
|
|
39
|
+
"M": ERROR_CORRECT_M,
|
|
40
|
+
"Q": ERROR_CORRECT_Q,
|
|
41
|
+
"H": ERROR_CORRECT_H
|
|
42
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
import getopt
|
|
5
|
+
from .qr_code_generator import make_qrcode, make_qrcode_svg
|
|
6
|
+
from .const import DRAWER_CLASSES, ERROR_CORRECTION_LEVELS
|
|
7
|
+
|
|
8
|
+
def print_usage():
|
|
9
|
+
print("""Usage: qrcode-pretty [options]
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
-h, --help Show this help message and exit
|
|
13
|
+
-d, --data <data> Data to encode in QR code (required)
|
|
14
|
+
-i, --image <image> Input image file name (optional)
|
|
15
|
+
-s, --style <style> Style for the QR code modules (optional)
|
|
16
|
+
--style-inner <style> Style for the inner eyes (optional)
|
|
17
|
+
--style-outer <style> Style for the outer eyes (optional)
|
|
18
|
+
-b, --base <hex> Base color hex code (e.g. #000000)
|
|
19
|
+
-n, --color-inner <hex> Inner eye color hex code
|
|
20
|
+
-r, --color-outer <hex> Outer eye color hex code
|
|
21
|
+
-o, --output <dir> Output directory path (default: ~/Pictures/qrcode-pretty/)
|
|
22
|
+
--svg Also generate SVG output (optional flag)
|
|
23
|
+
--version <int> QR version (default: 5)
|
|
24
|
+
--box-size <int> Box size in pixels (default: 10)
|
|
25
|
+
--border <int> Border size in boxes (default: 4)
|
|
26
|
+
--error-correction <L|M|Q|H> Error correction level (default: H)
|
|
27
|
+
|
|
28
|
+
Available styles: square, gapped-square, circle, round, vertical-bars, horizontal-bars
|
|
29
|
+
|
|
30
|
+
Example:
|
|
31
|
+
entrypoint.py -d "https://example.com" -i logo.png -b #000000 -n #000fff -r #fff000 -o ./output --style circle --style-inner square --style-outer circle --svg
|
|
32
|
+
""")
|
|
33
|
+
|
|
34
|
+
def main(argv=None):
|
|
35
|
+
if argv is None:
|
|
36
|
+
argv = sys.argv[1:]
|
|
37
|
+
|
|
38
|
+
kwargs = {}
|
|
39
|
+
include_svg = False
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
opts, args = getopt.getopt(
|
|
43
|
+
argv,
|
|
44
|
+
"hi:o:d:b:n:r:s:",
|
|
45
|
+
[
|
|
46
|
+
"image=",
|
|
47
|
+
"output=",
|
|
48
|
+
"data=",
|
|
49
|
+
"base=",
|
|
50
|
+
"color-inner=",
|
|
51
|
+
"color-outer=",
|
|
52
|
+
"svg",
|
|
53
|
+
"style=",
|
|
54
|
+
"style-inner=",
|
|
55
|
+
"style-outer=",
|
|
56
|
+
"version=",
|
|
57
|
+
"box-size=",
|
|
58
|
+
"border=",
|
|
59
|
+
"error-correction="
|
|
60
|
+
]
|
|
61
|
+
)
|
|
62
|
+
except getopt.GetoptError:
|
|
63
|
+
print_usage()
|
|
64
|
+
sys.exit(2)
|
|
65
|
+
|
|
66
|
+
for opt, arg in opts:
|
|
67
|
+
if opt == '-h':
|
|
68
|
+
print_usage()
|
|
69
|
+
sys.exit()
|
|
70
|
+
|
|
71
|
+
elif opt in ("-d", "--data"):
|
|
72
|
+
kwargs["input_data"] = arg
|
|
73
|
+
|
|
74
|
+
elif opt in ("-i", "--image"):
|
|
75
|
+
kwargs["input_image"] = arg
|
|
76
|
+
|
|
77
|
+
elif opt in ("-s", "--style"):
|
|
78
|
+
if arg not in DRAWER_CLASSES:
|
|
79
|
+
print(f"Error: style '{arg}' not recognized. Choose one of: {', '.join(DRAWER_CLASSES.keys())}")
|
|
80
|
+
sys.exit(1)
|
|
81
|
+
kwargs["drawer_instance"] = DRAWER_CLASSES[arg]()
|
|
82
|
+
|
|
83
|
+
elif opt == "--style-inner":
|
|
84
|
+
if arg not in DRAWER_CLASSES:
|
|
85
|
+
print(f"Error: style-inner '{arg}' not recognized. Choose one of: {', '.join(DRAWER_CLASSES.keys())}")
|
|
86
|
+
sys.exit(1)
|
|
87
|
+
kwargs["drawer_instance_inner"] = DRAWER_CLASSES[arg]()
|
|
88
|
+
|
|
89
|
+
elif opt == "--style-outer":
|
|
90
|
+
if arg not in DRAWER_CLASSES:
|
|
91
|
+
print(f"Error: style-outer '{arg}' not recognized. Choose one of: {', '.join(DRAWER_CLASSES.keys())}")
|
|
92
|
+
sys.exit(1)
|
|
93
|
+
kwargs["drawer_instance_outer"] = DRAWER_CLASSES[arg]()
|
|
94
|
+
|
|
95
|
+
elif opt in ("-b", "--base"):
|
|
96
|
+
kwargs["base_color"] = arg
|
|
97
|
+
|
|
98
|
+
elif opt in ("-n", "--color-inner"):
|
|
99
|
+
kwargs["inner_eye_color"] = arg
|
|
100
|
+
|
|
101
|
+
elif opt in ("-r", "--color-outer"):
|
|
102
|
+
kwargs["outer_eye_color"] = arg
|
|
103
|
+
|
|
104
|
+
elif opt == "--version":
|
|
105
|
+
kwargs["version"] = int(arg)
|
|
106
|
+
|
|
107
|
+
elif opt == "--box-size":
|
|
108
|
+
kwargs["box_size"] = int(arg)
|
|
109
|
+
|
|
110
|
+
elif opt == "--border":
|
|
111
|
+
kwargs["border"] = int(arg)
|
|
112
|
+
|
|
113
|
+
elif opt == "--error-correction":
|
|
114
|
+
ec_levels = ERROR_CORRECTION_LEVELS
|
|
115
|
+
arg_upper = arg.upper()
|
|
116
|
+
if arg_upper in ec_levels:
|
|
117
|
+
kwargs["error_correction"] = ec_levels[arg_upper]
|
|
118
|
+
else:
|
|
119
|
+
print("Invalid error correction level. Choose from: L, M, Q, H.")
|
|
120
|
+
sys.exit(1)
|
|
121
|
+
|
|
122
|
+
elif opt in ("-o", "--output"):
|
|
123
|
+
kwargs["output_dir"] = arg
|
|
124
|
+
|
|
125
|
+
elif opt == "--svg":
|
|
126
|
+
include_svg = True
|
|
127
|
+
|
|
128
|
+
if "input_data" not in kwargs:
|
|
129
|
+
print("Error: Missing required option --data/-d")
|
|
130
|
+
print_usage()
|
|
131
|
+
sys.exit(1)
|
|
132
|
+
|
|
133
|
+
make_qrcode(**kwargs)
|
|
134
|
+
|
|
135
|
+
if include_svg:
|
|
136
|
+
make_qrcode_svg(kwargs["input_data"], kwargs.get("output_dir", "~/Pictures/qrcode-pretty/"))
|
|
137
|
+
|
|
138
|
+
if __name__ == "__main__":
|
|
139
|
+
main(sys.argv[1:])
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import qrcode
|
|
4
|
+
from qrcode.constants import ERROR_CORRECT_H
|
|
5
|
+
import qrcode.image.svg
|
|
6
|
+
from qrcode.image.styles.moduledrawers.svg import SvgSquareDrawer
|
|
7
|
+
from qrcode.image.styledpil import StyledPilImage
|
|
8
|
+
from qrcode.image.styles.moduledrawers.pil import RoundedModuleDrawer
|
|
9
|
+
from qrcode.image.styles.colormasks import RadialGradiantColorMask, SolidFillColorMask
|
|
10
|
+
from PIL import Image, ImageDraw
|
|
11
|
+
import os
|
|
12
|
+
import sys
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Custom function for eye styling. These create the eye masks
|
|
16
|
+
class Qr_image_parts:
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
embeded_image_name,
|
|
20
|
+
inner_eyes_image,
|
|
21
|
+
inner_eye_mask,
|
|
22
|
+
outer_eyes_image,
|
|
23
|
+
outer_eye_mask,
|
|
24
|
+
qr_image,
|
|
25
|
+
qr_image_simple,
|
|
26
|
+
) -> None:
|
|
27
|
+
self.embeded_image_name = embeded_image_name
|
|
28
|
+
self.inner_eyes_image = inner_eyes_image
|
|
29
|
+
self.inner_eye_mask = inner_eye_mask
|
|
30
|
+
self.outer_eyes_image = outer_eyes_image
|
|
31
|
+
self.outer_eye_mask = outer_eye_mask
|
|
32
|
+
self.qr_image = qr_image
|
|
33
|
+
self.qr_image_simple = qr_image_simple
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def find_default_image():
|
|
37
|
+
"""Find the default image in standard locations.
|
|
38
|
+
|
|
39
|
+
Searches for the default image in the following order:
|
|
40
|
+
1. Environment variable DEFAULT_IMAGE (highest priority)
|
|
41
|
+
2. System-wide install: /usr/share/qrcode-pretty/assets/default.png
|
|
42
|
+
3. Python prefix install: {sys.prefix}/share/qrcode-pretty/assets/default.png
|
|
43
|
+
4. Local development: ./assets/default.png
|
|
44
|
+
5. Package relative: ../../assets/default.png (from module directory)
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
str: Path to the default image, or fallback to ./assets/default.png
|
|
48
|
+
"""
|
|
49
|
+
search_paths = [
|
|
50
|
+
os.environ.get("DEFAULT_IMAGE"),
|
|
51
|
+
"/usr/share/qrcode-pretty/assets/default.png",
|
|
52
|
+
os.path.join(sys.prefix, "share/qrcode-pretty/assets/default.png"),
|
|
53
|
+
"./assets/default.png",
|
|
54
|
+
os.path.join(os.path.dirname(__file__), "..", "..", "assets", "default.png"),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
for path in search_paths:
|
|
58
|
+
if path and os.path.isfile(path):
|
|
59
|
+
return path
|
|
60
|
+
|
|
61
|
+
return "./assets/default.png"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def hex_to_rgb(hex):
|
|
65
|
+
hex = hex.lstrip("#")
|
|
66
|
+
return (
|
|
67
|
+
int(hex[0:2], 16),
|
|
68
|
+
int(hex[2:4], 16),
|
|
69
|
+
int(hex[4:6], 16),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def style_inner_eyes(image, box_size=10, border=4, modules_count=37):
|
|
74
|
+
mask = Image.new("L", image.size, 0)
|
|
75
|
+
draw = ImageDraw.Draw(mask)
|
|
76
|
+
|
|
77
|
+
def draw_eye(x_mod, y_mod):
|
|
78
|
+
# Offset by 2 modules to land in center of 7x7 eye
|
|
79
|
+
x = (border + x_mod + 2) * box_size
|
|
80
|
+
y = (border + y_mod + 2) * box_size
|
|
81
|
+
draw.rectangle((x, y, x + 3 * box_size, y + 3 * box_size), fill=255)
|
|
82
|
+
|
|
83
|
+
draw_eye(0, 0) # top-left
|
|
84
|
+
draw_eye(modules_count - 7, 0) # top-right
|
|
85
|
+
draw_eye(0, modules_count - 7) # bottom-left
|
|
86
|
+
|
|
87
|
+
return mask
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def style_outer_eyes(image, box_size=10, border=4, modules_count=37):
|
|
91
|
+
img_size = image.size[0]
|
|
92
|
+
mask = Image.new("L", image.size, 0)
|
|
93
|
+
draw = ImageDraw.Draw(mask)
|
|
94
|
+
|
|
95
|
+
def draw_eye(x_mod, y_mod):
|
|
96
|
+
x = border * box_size + x_mod * box_size
|
|
97
|
+
y = border * box_size + y_mod * box_size
|
|
98
|
+
draw.rectangle((x, y, x + 7 * box_size, y + 7 * box_size), fill=255)
|
|
99
|
+
draw.rectangle(
|
|
100
|
+
(x + 2 * box_size, y + 2 * box_size, x + 5 * box_size, y + 5 * box_size),
|
|
101
|
+
fill=0,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
draw_eye(0, 0) # top-left
|
|
105
|
+
draw_eye(modules_count - 7, 0) # top-right
|
|
106
|
+
draw_eye(0, modules_count - 7) # bottom-left
|
|
107
|
+
|
|
108
|
+
return mask
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
# Create a QR code instance
|
|
112
|
+
def create_qrcode_instance(
|
|
113
|
+
version=5, error_correction=ERROR_CORRECT_H, box_size=10, border=4
|
|
114
|
+
):
|
|
115
|
+
return qrcode.QRCode(
|
|
116
|
+
version=version,
|
|
117
|
+
error_correction=error_correction,
|
|
118
|
+
box_size=box_size,
|
|
119
|
+
border=border,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# Add data to the QR code
|
|
124
|
+
def add_data(qr, input_data):
|
|
125
|
+
qr.add_data(input_data)
|
|
126
|
+
qr.make(fit=True)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# Create an image from the QR code instance
|
|
130
|
+
def create_image(
|
|
131
|
+
qr,
|
|
132
|
+
input_image,
|
|
133
|
+
drawer_instance,
|
|
134
|
+
drawer_instance_inner,
|
|
135
|
+
drawer_instance_outer,
|
|
136
|
+
base_color,
|
|
137
|
+
inner_eye_color,
|
|
138
|
+
outer_eye_color,
|
|
139
|
+
version,
|
|
140
|
+
error_correction,
|
|
141
|
+
box_size,
|
|
142
|
+
border,
|
|
143
|
+
):
|
|
144
|
+
inner_eyes_image = qr.make_image(
|
|
145
|
+
image_factory=StyledPilImage,
|
|
146
|
+
eye_drawer=drawer_instance_inner,
|
|
147
|
+
color_mask=SolidFillColorMask(front_color=hex_to_rgb(inner_eye_color)),
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
outer_eyes_image = qr.make_image(
|
|
151
|
+
image_factory=StyledPilImage,
|
|
152
|
+
eye_drawer=drawer_instance_outer,
|
|
153
|
+
color_mask=SolidFillColorMask(front_color=hex_to_rgb(outer_eye_color)),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
embeded_image_name = input_image
|
|
157
|
+
|
|
158
|
+
if embeded_image_name == "default":
|
|
159
|
+
embeded_image_path = find_default_image()
|
|
160
|
+
elif embeded_image_name:
|
|
161
|
+
path_expanded = os.path.expanduser(embeded_image_name)
|
|
162
|
+
if os.path.isfile(path_expanded):
|
|
163
|
+
embeded_image_path = path_expanded
|
|
164
|
+
else:
|
|
165
|
+
embeded_image_path = None
|
|
166
|
+
else:
|
|
167
|
+
embeded_image_path = None
|
|
168
|
+
|
|
169
|
+
kwargs = {
|
|
170
|
+
"image_factory": StyledPilImage,
|
|
171
|
+
"module_drawer": drawer_instance,
|
|
172
|
+
"color_mask": SolidFillColorMask(front_color=hex_to_rgb(base_color)),
|
|
173
|
+
}
|
|
174
|
+
if embeded_image_path:
|
|
175
|
+
kwargs["embeded_image_path"] = embeded_image_path
|
|
176
|
+
|
|
177
|
+
qr_image = qr.make_image(**kwargs)
|
|
178
|
+
|
|
179
|
+
qr_image_simple = qr.make_image(
|
|
180
|
+
image_factory=StyledPilImage,
|
|
181
|
+
module_drawer=drawer_instance,
|
|
182
|
+
color_mask=SolidFillColorMask(front_color=hex_to_rgb(base_color)),
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
inner_eye_mask = style_inner_eyes(qr_image, box_size, border, qr.modules_count)
|
|
186
|
+
outer_eye_mask = style_outer_eyes(qr_image, box_size, border, qr.modules_count)
|
|
187
|
+
return Qr_image_parts(
|
|
188
|
+
embeded_image_name,
|
|
189
|
+
inner_eyes_image,
|
|
190
|
+
inner_eye_mask,
|
|
191
|
+
outer_eyes_image,
|
|
192
|
+
outer_eye_mask,
|
|
193
|
+
qr_image,
|
|
194
|
+
qr_image_simple,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
# Generate qr code based on image input
|
|
199
|
+
def generate_qr_code(qr, qr_image_parts, drawer_instance):
|
|
200
|
+
qr_image_parts.inner_eyes_image = qr_image_parts.inner_eyes_image.convert("RGBA")
|
|
201
|
+
qr_image_parts.outer_eyes_image = qr_image_parts.outer_eyes_image.convert("RGBA")
|
|
202
|
+
qr_image_parts.qr_image = qr_image_parts.qr_image.convert("RGBA")
|
|
203
|
+
qr_image_parts.inner_eye_mask = qr_image_parts.inner_eye_mask.convert("L")
|
|
204
|
+
qr_image_parts.outer_eye_mask = qr_image_parts.outer_eye_mask.convert("L")
|
|
205
|
+
|
|
206
|
+
if (
|
|
207
|
+
not qr_image_parts.embeded_image_name
|
|
208
|
+
or qr_image_parts.embeded_image_name == "blank"
|
|
209
|
+
):
|
|
210
|
+
intermediate_image = Image.composite(
|
|
211
|
+
qr_image_parts.inner_eyes_image,
|
|
212
|
+
qr_image_parts.qr_image_simple,
|
|
213
|
+
qr_image_parts.inner_eye_mask,
|
|
214
|
+
)
|
|
215
|
+
elif qr_image_parts.embeded_image_name == "default":
|
|
216
|
+
intermediate_image = Image.composite(
|
|
217
|
+
qr_image_parts.inner_eyes_image,
|
|
218
|
+
qr_image_parts.qr_image,
|
|
219
|
+
qr_image_parts.inner_eye_mask,
|
|
220
|
+
)
|
|
221
|
+
else:
|
|
222
|
+
embeded_image_path = os.path.expanduser(qr_image_parts.embeded_image_name)
|
|
223
|
+
if not os.path.isabs(embeded_image_path) and not os.path.isfile(
|
|
224
|
+
embeded_image_path
|
|
225
|
+
):
|
|
226
|
+
embeded_image_path = os.path.join("./assets/", embeded_image_path)
|
|
227
|
+
|
|
228
|
+
qr_image = qr.make_image(
|
|
229
|
+
image_factory=StyledPilImage,
|
|
230
|
+
module_drawer=drawer_instance,
|
|
231
|
+
embeded_image_path=embeded_image_path,
|
|
232
|
+
)
|
|
233
|
+
intermediate_image = Image.composite(
|
|
234
|
+
qr_image_parts.inner_eyes_image, qr_image, qr_image_parts.inner_eye_mask
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
return Image.composite(
|
|
238
|
+
qr_image_parts.outer_eyes_image,
|
|
239
|
+
intermediate_image,
|
|
240
|
+
qr_image_parts.outer_eye_mask,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
# Save the image to a file
|
|
245
|
+
def save_image(final_image, output_dir):
|
|
246
|
+
output_dir = os.path.expanduser(output_dir) # Expand tilde
|
|
247
|
+
if not os.path.exists(output_dir):
|
|
248
|
+
print(f"Output directory '{output_dir}' does not exist. Creating it.")
|
|
249
|
+
os.makedirs(output_dir)
|
|
250
|
+
result_path = os.path.join(output_dir, "qrcode.png")
|
|
251
|
+
print("Saving qr-code (png) to: ", result_path)
|
|
252
|
+
final_image.save(result_path)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
# main function that calls all steps needed to make a qrcode
|
|
256
|
+
def make_qrcode(
|
|
257
|
+
input_data,
|
|
258
|
+
input_image=None,
|
|
259
|
+
drawer_instance=RoundedModuleDrawer(),
|
|
260
|
+
drawer_instance_inner=RoundedModuleDrawer(),
|
|
261
|
+
drawer_instance_outer=RoundedModuleDrawer(),
|
|
262
|
+
base_color="#000000",
|
|
263
|
+
inner_eye_color="#000000",
|
|
264
|
+
outer_eye_color="#000000",
|
|
265
|
+
version=5,
|
|
266
|
+
error_correction=ERROR_CORRECT_H,
|
|
267
|
+
box_size=10,
|
|
268
|
+
border=4,
|
|
269
|
+
output_dir="~/Pictures/qrcode-pretty/",
|
|
270
|
+
):
|
|
271
|
+
qr = create_qrcode_instance(
|
|
272
|
+
version=version,
|
|
273
|
+
error_correction=error_correction,
|
|
274
|
+
box_size=box_size,
|
|
275
|
+
border=border,
|
|
276
|
+
)
|
|
277
|
+
add_data(qr, input_data)
|
|
278
|
+
qr_image_parts = create_image(
|
|
279
|
+
qr,
|
|
280
|
+
input_image,
|
|
281
|
+
drawer_instance,
|
|
282
|
+
drawer_instance_inner,
|
|
283
|
+
drawer_instance_outer,
|
|
284
|
+
base_color,
|
|
285
|
+
inner_eye_color,
|
|
286
|
+
outer_eye_color,
|
|
287
|
+
version,
|
|
288
|
+
error_correction,
|
|
289
|
+
box_size,
|
|
290
|
+
border,
|
|
291
|
+
)
|
|
292
|
+
final_image = generate_qr_code(qr, qr_image_parts, drawer_instance)
|
|
293
|
+
save_image(final_image, output_dir)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
# Additionaly to the png qrcode an svg is created as well
|
|
297
|
+
def make_qrcode_svg(input_data, output_dir="~/Pictures/qrcode-pretty/"):
|
|
298
|
+
output_dir = os.path.expanduser(output_dir) # Expand tilde
|
|
299
|
+
qr = create_qrcode_instance()
|
|
300
|
+
add_data(qr, input_data)
|
|
301
|
+
qr_svg = qr.make_image(
|
|
302
|
+
image_factory=qrcode.image.svg.SvgImage,
|
|
303
|
+
module_drawer=SvgSquareDrawer(),
|
|
304
|
+
)
|
|
305
|
+
if not os.path.exists(output_dir):
|
|
306
|
+
os.makedirs(output_dir)
|
|
307
|
+
result_path = os.path.join(output_dir, "qrcode.svg")
|
|
308
|
+
print("Saving qr-code (svg) to: ", result_path)
|
|
309
|
+
qr_svg.save(result_path)
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qrcode-pretty
|
|
3
|
+
Version: 1.0.3
|
|
4
|
+
Summary: A tool which generates pretty QR codes
|
|
5
|
+
Project-URL: Homepage, https://www.afkdev8.com/
|
|
6
|
+
Project-URL: Repository, https://github.com/mrinfinidy/qrcode-pretty
|
|
7
|
+
Project-URL: Issues, https://github.com/mrinfinidy/qrcode-pretty/issues
|
|
8
|
+
Author-email: afkdev8 <mail@afkdev8.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: customizable,generator,pretty,qr,qrcode
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Requires-Dist: pillow>=9.0
|
|
27
|
+
Requires-Dist: qrcode[pil]>=7.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Pretty QR Code
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
Generate pretty QR codes.
|
|
37
|
+
|
|
38
|
+
Pretty QR Code uses the [python-qrcode](https://github.com/lincolnloop/python-qrcode) library to generate qr codes
|
|
39
|
+
and provides various options to customize the qrcode.
|
|
40
|
+
You can adjust style, color and add an image in the middle.
|
|
41
|
+
Check out the usage for all available options.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### NixOS
|
|
46
|
+
|
|
47
|
+
This tool is packaged as a NixOS package. You can install it using the following flake input:
|
|
48
|
+
|
|
49
|
+
```nix
|
|
50
|
+
qrcode-pretty = {
|
|
51
|
+
url = "github:mrinfinidy/qrcode-pretty";
|
|
52
|
+
inputs.nixpkgs.follows = "nixpkgs";
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Add the flake input to the outputs:
|
|
57
|
+
|
|
58
|
+
```nix
|
|
59
|
+
outputs = {
|
|
60
|
+
# your other outputs
|
|
61
|
+
qrcode-pretty,
|
|
62
|
+
...
|
|
63
|
+
}@inputs:
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Then add to your home-manager config:
|
|
67
|
+
|
|
68
|
+
```nix
|
|
69
|
+
home-manager.users.<your-user> = {
|
|
70
|
+
home.packages = [
|
|
71
|
+
(inputs.qrcode-pretty.packages.${pkgs.system}.default)
|
|
72
|
+
];
|
|
73
|
+
};
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or build and run directly:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Build with Nix
|
|
80
|
+
nix build github:mrinfinidy/qrcode-pretty#qrcode-pretty
|
|
81
|
+
|
|
82
|
+
# Run from local checkout
|
|
83
|
+
nix run .#qrcode-pretty -- -d "your data here"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Debian/Ubuntu
|
|
87
|
+
|
|
88
|
+
Download and install the `.deb` package from the [releases page](https://github.com/mrinfinidy/qrcode-pretty/releases):
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Download the latest .deb package
|
|
92
|
+
wget https://github.com/mrinfinidy/qrcode-pretty/releases/download/<version>/qrcode-pretty_<version>-1_all.deb
|
|
93
|
+
|
|
94
|
+
# Install the package
|
|
95
|
+
sudo dpkg -i qrcode-pretty_<version>-1_all.deb
|
|
96
|
+
|
|
97
|
+
# Install dependencies if needed
|
|
98
|
+
sudo apt-get install -f
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Or build from source (see [PACKAGING.md](PACKAGING.md) for details):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
dpkg-buildpackage -us -uc -b
|
|
105
|
+
sudo dpkg -i ../qrcode-pretty_<version>-1_all.deb
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Arch Linux (AUR)
|
|
109
|
+
|
|
110
|
+
Install from the AUR using your preferred AUR helper:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Using yay
|
|
114
|
+
yay -S qrcode-pretty
|
|
115
|
+
|
|
116
|
+
# Using paru
|
|
117
|
+
paru -S qrcode-pretty
|
|
118
|
+
|
|
119
|
+
# Or manually with makepkg
|
|
120
|
+
git clone https://aur.archlinux.org/qrcode-pretty.git
|
|
121
|
+
cd qrcode-pretty
|
|
122
|
+
makepkg -si
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Using uv
|
|
126
|
+
|
|
127
|
+
[uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver, which I prefer over pip/pipx:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
uv tool install qrcode-pretty
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Using pipx
|
|
134
|
+
|
|
135
|
+
For installing as a standalone command-line tool:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pipx install qrcode-pretty
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
### Requirements
|
|
144
|
+
|
|
145
|
+
- Python 3.8 or higher
|
|
146
|
+
- Dependencies (automatically installed):
|
|
147
|
+
- qrcode[pil] >= 7.0
|
|
148
|
+
- pillow >= 9.0
|
|
149
|
+
|
|
150
|
+
### Setting Up Development Environment
|
|
151
|
+
|
|
152
|
+
#### Using NixOS
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Clone the repository
|
|
156
|
+
git clone https://github.com/mrinfinidy/qrcode-pretty.git
|
|
157
|
+
cd qrcode-pretty
|
|
158
|
+
|
|
159
|
+
# Enter development shell
|
|
160
|
+
nix-shell
|
|
161
|
+
|
|
162
|
+
# Or use the flake development shell
|
|
163
|
+
nix develop
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Using uv
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Clone the repository
|
|
170
|
+
git clone https://github.com/mrinfinidy/qrcode-pretty.git
|
|
171
|
+
cd qrcode-pretty
|
|
172
|
+
|
|
173
|
+
# Create virtual environment and install in editable mode
|
|
174
|
+
uv venv
|
|
175
|
+
source .venv/bin/activate # On Linux/Mac
|
|
176
|
+
# or: .venv\Scripts\activate # On Windows
|
|
177
|
+
|
|
178
|
+
uv pip install -e .
|
|
179
|
+
|
|
180
|
+
# Run the tool
|
|
181
|
+
qrcode-pretty -d "test"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Using pip/venv
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Clone the repository
|
|
188
|
+
git clone https://github.com/mrinfinidy/qrcode-pretty.git
|
|
189
|
+
cd qrcode-pretty
|
|
190
|
+
|
|
191
|
+
# Create and activate virtual environment
|
|
192
|
+
python -m venv .venv
|
|
193
|
+
source .venv/bin/activate # On Linux/Mac
|
|
194
|
+
# or: .venv\Scripts\activate # On Windows
|
|
195
|
+
|
|
196
|
+
# Install in editable mode
|
|
197
|
+
pip install -e .
|
|
198
|
+
|
|
199
|
+
# Run the tool
|
|
200
|
+
qrcode-pretty -d "test"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Building the Package
|
|
204
|
+
|
|
205
|
+
#### With Nix
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Build with Nix
|
|
209
|
+
nix build .#qrcode-pretty
|
|
210
|
+
|
|
211
|
+
# Result will be in ./result/
|
|
212
|
+
./result/bin/qrcode-pretty --help
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### With uv
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Build wheel and source distribution
|
|
219
|
+
uv build
|
|
220
|
+
|
|
221
|
+
# Output will be in dist/ e.g.:
|
|
222
|
+
# - dist/qrcode_pretty-1.0.0-py3-none-any.whl
|
|
223
|
+
# - dist/qrcode_pretty-1.0.0.tar.gz
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Usage
|
|
227
|
+
|
|
228
|
+
Pretty QR Code provides the `qrcode-pretty` command-line tool.
|
|
229
|
+
|
|
230
|
+
### Basic Usage
|
|
231
|
+
|
|
232
|
+
Generate a QR code with minimal options:
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
qrcode-pretty -d "https://github.com/mrinfinidy/qrcode-pretty"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Command-Line Options
|
|
239
|
+
|
|
240
|
+
Use `qrcode-pretty -h` to print all available options:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
Options:
|
|
244
|
+
-h, --help Show this help message and exit
|
|
245
|
+
-d, --data <data> Data to encode in QR code (required)
|
|
246
|
+
-i, --image <image> Input image file name (optional)
|
|
247
|
+
-s, --style <style> Style for the QR code modules (optional)
|
|
248
|
+
--style-inner <style> Style for the inner eyes (optional)
|
|
249
|
+
--style-outer <style> Style for the outer eyes (optional)
|
|
250
|
+
-b, --base <hex> Base color hex code (e.g. #000000)
|
|
251
|
+
-n, --color-inner <hex> Inner eye color hex code
|
|
252
|
+
-r, --color-outer <hex> Outer eye color hex code
|
|
253
|
+
-o, --output <dir> Output directory path (default: ~/Pictures/qrcode-pretty/)
|
|
254
|
+
--svg Also generate SVG output (optional flag)
|
|
255
|
+
--version <int> QR version (default: 5)
|
|
256
|
+
--box-size <int> Box size in pixels (default: 10)
|
|
257
|
+
--border <int> Border size in boxes (default: 4)
|
|
258
|
+
--error-correction <L|M|Q|H> Error correction level (default: H)
|
|
259
|
+
|
|
260
|
+
Available styles: square, gapped-square, circle, round, vertical-bars, horizontal-bars
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Note:** When embedding a center image (logo), it is recommended to use a high error correction level (default: H).
|
|
264
|
+
|
|
265
|
+
**About the `--image` option:**
|
|
266
|
+
|
|
267
|
+
- Use `--image /path/to/your/logo.png` to embed your own image in the QR code center
|
|
268
|
+
- Use `--image default` to use the bundled demonstration image (included with all installation methods)
|
|
269
|
+
- Omit `--image` to generate a QR code without a center image
|
|
270
|
+
|
|
271
|
+
### Sample Gallery
|
|
272
|
+
|
|
273
|
+
#### QR Code Github
|
|
274
|
+
|
|
275
|
+

|
|
276
|
+
|
|
277
|
+
`qrcode-pretty --data "https://github.com/mrinfinidy/qrcode-pretty" --image default --style circle --style-inner round --style-outer round --base "#000000" --color-inner "#ff7373" --color-outer "#000000" --output "~/Pictures/"`
|
|
278
|
+
|
|
279
|
+

|
|
280
|
+
|
|
281
|
+
`qrcode-pretty --data "https://github.com/mrinfinidy/qrcode-pretty" --image default --style round --style-inner round --style-outer round --base "#1d2021" --color-inner "#d3869b" --color-outer "#458588" --output "~/Pictures/"`
|
|
282
|
+
|
|
283
|
+

|
|
284
|
+
|
|
285
|
+
`qrcode-pretty --data "https://github.com/mrinfinidy/qrcode-pretty" --style round --style-inner round --style-outer round --base "#8e8ece" --color-inner "#6cf2e5" --color-outer "#40E0D0" --output "~/Pictures/"`
|
|
286
|
+
|
|
287
|
+
#### QR Code afkdev8 (my homepage)
|
|
288
|
+
|
|
289
|
+

|
|
290
|
+
|
|
291
|
+
`qrcode-pretty --data "https://www.afkdev8.com/" --image "~/Pictures/afkdev8-logo.png" --style vertical-bars --style-inner round --style-outer round --base "#000000" --color-inner "#000000" --color-outer "#000000" --output "~/Pictures/"`
|
|
292
|
+
|
|
293
|
+

|
|
294
|
+
|
|
295
|
+
`qrcode-pretty --data "https://www.afkdev8.com/" --image "~/Pictures/afkdev8-logo-dark.png" --style horizontal-bars --style-inner round --style-outer round --base "#000000" --color-inner "#000000" --color-outer "#000000" --output "~/Pictures/"`
|
|
296
|
+
|
|
297
|
+
#### QR Code lemons
|
|
298
|
+
|
|
299
|
+

|
|
300
|
+
|
|
301
|
+
`qrcode-pretty --data "lemons" --image "~/Pictures/lemons.png" --style square --style-inner circle --style-outer gapped-square --base "#000000" --color-inner "#000000" --color-outer "#000000" --output "~/Pictures/"`
|
|
302
|
+
|
|
303
|
+
## Package Information
|
|
304
|
+
|
|
305
|
+
This package follows modern Python packaging standards:
|
|
306
|
+
|
|
307
|
+
- **Package Name**: `qrcode-pretty`
|
|
308
|
+
- **Module Name**: `qrcode_pretty`
|
|
309
|
+
- **Build System**: [Hatchling](https://hatch.pypa.io/)
|
|
310
|
+
- **Configuration**: `pyproject.toml` (PEP 621 compliant)
|
|
311
|
+
- **Minimum Python**: 3.8+
|
|
312
|
+
|
|
313
|
+
### Project Structure
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
qrcode-pretty/
|
|
317
|
+
├── src/
|
|
318
|
+
│ └── qrcode_pretty/
|
|
319
|
+
│ ├── __init__.py
|
|
320
|
+
│ ├── entrypoint.py
|
|
321
|
+
│ ├── qr_code_generator.py
|
|
322
|
+
│ └── const.py
|
|
323
|
+
├── pyproject.toml
|
|
324
|
+
├── README.md
|
|
325
|
+
└── LICENSE
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Author
|
|
329
|
+
|
|
330
|
+
afkdev8 `<mail@afkdev8.com>`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
qrcode_pretty/__init__.py,sha256=a0RS5WI9lpnyvidWQ6R909Oh838Xh65NYsCQbrQKp3k,319
|
|
2
|
+
qrcode_pretty/const.py,sha256=ANaVKVKpBnDurwT7soNVuBv_A-0LlFs7wKvSM4Zeops,864
|
|
3
|
+
qrcode_pretty/entrypoint.py,sha256=a5_wOgQibn747XSXkuz5HSmahzKxSs3FIfNKpWga8Yw,4659
|
|
4
|
+
qrcode_pretty/qr_code_generator.py,sha256=bWh2l8f4M_c72zhE_5NM5mmfy-QWQ6bXpr8Wc01bh7M,9735
|
|
5
|
+
qrcode_pretty-1.0.3.dist-info/METADATA,sha256=jZWrqpjs3mX7uwoRJoGHLSFMtFkql3vU_j2rnDLXRRk,9105
|
|
6
|
+
qrcode_pretty-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
7
|
+
qrcode_pretty-1.0.3.dist-info/entry_points.txt,sha256=H-vyuHOFhAZ9rxl1sH5uAtrTxP14grG8aDHmxVt3Ifc,64
|
|
8
|
+
qrcode_pretty-1.0.3.dist-info/licenses/LICENSE,sha256=ScPJeyY_mS7hVKFT8hPad2QVMSsj1_5BScGXidtDZgE,4697
|
|
9
|
+
qrcode_pretty-1.0.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 afkdev8
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
--- BEGIN DEPENDENCY LICENSES ---
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2011, Lincoln Loop
|
|
26
|
+
All rights reserved.
|
|
27
|
+
|
|
28
|
+
Redistribution and use in source and binary forms, with or without
|
|
29
|
+
modification, are permitted provided that the following conditions are met:
|
|
30
|
+
|
|
31
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
32
|
+
this list of conditions and the following disclaimer.
|
|
33
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
34
|
+
this list of conditions and the following disclaimer in the documentation
|
|
35
|
+
and/or other materials provided with the distribution.
|
|
36
|
+
* Neither the package name nor the names of its contributors may be
|
|
37
|
+
used to endorse or promote products derived from this software without
|
|
38
|
+
specific prior written permission.
|
|
39
|
+
|
|
40
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
41
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
42
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
43
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
44
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
45
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
46
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
47
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
48
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
49
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
-------------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
Original text and license from the pyqrnative package where this was forked
|
|
56
|
+
from (http://code.google.com/p/pyqrnative):
|
|
57
|
+
|
|
58
|
+
#Ported from the Javascript library by Sam Curren
|
|
59
|
+
#
|
|
60
|
+
#QRCode for Javascript
|
|
61
|
+
#http://d-project.googlecode.com/svn/trunk/misc/qrcode/js/qrcode.js
|
|
62
|
+
#
|
|
63
|
+
#Copyright (c) 2009 Kazuhiko Arase
|
|
64
|
+
#
|
|
65
|
+
#URL: http://www.d-project.com/
|
|
66
|
+
#
|
|
67
|
+
#Licensed under the MIT license:
|
|
68
|
+
# http://www.opensource.org/licenses/mit-license.php
|
|
69
|
+
#
|
|
70
|
+
# The word "QR Code" is registered trademark of
|
|
71
|
+
# DENSO WAVE INCORPORATED
|
|
72
|
+
# http://www.denso-wave.com/qrcode/faqpatent-e.html
|
|
73
|
+
|
|
74
|
+
The Python Imaging Library (PIL) is
|
|
75
|
+
|
|
76
|
+
Copyright © 1997-2011 by Secret Labs AB
|
|
77
|
+
Copyright © 1995-2011 by Fredrik Lundh and contributors
|
|
78
|
+
|
|
79
|
+
Pillow is the friendly PIL fork. It is
|
|
80
|
+
|
|
81
|
+
Copyright © 2010 by Jeffrey A. Clark and contributors
|
|
82
|
+
|
|
83
|
+
Like PIL, Pillow is licensed under the open source MIT-CMU License:
|
|
84
|
+
|
|
85
|
+
By obtaining, using, and/or copying this software and/or its associated
|
|
86
|
+
documentation, you agree that you have read, understood, and will comply
|
|
87
|
+
with the following terms and conditions:
|
|
88
|
+
|
|
89
|
+
Permission to use, copy, modify and distribute this software and its
|
|
90
|
+
documentation for any purpose and without fee is hereby granted,
|
|
91
|
+
provided that the above copyright notice appears in all copies, and that
|
|
92
|
+
both that copyright notice and this permission notice appear in supporting
|
|
93
|
+
documentation, and that the name of Secret Labs AB or the author not be
|
|
94
|
+
used in advertising or publicity pertaining to distribution of the software
|
|
95
|
+
without specific, written prior permission.
|
|
96
|
+
|
|
97
|
+
SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
98
|
+
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
|
|
99
|
+
IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
|
|
100
|
+
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
101
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
102
|
+
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
103
|
+
PERFORMANCE OF THIS SOFTWARE.
|