Skip to content

Commit 007abc3

Browse files
authored
Merge pull request #2 from OUDON/develop
v0.1.0
2 parents 99d7dce + 053dd6b commit 007abc3

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

.github/workflows/python-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Python application
55

66
on:
77
push:
8-
branches: [ "main" ]
8+
branches: [ "main", "develop" ]
99
pull_request:
10-
branches: [ "develop" ]
10+
branches: [ "main", "develop" ]
1111

1212
permissions:
1313
contents: read

.github/workflows/python-publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ jobs:
3737
with:
3838
user: __token__
3939
password: ${{ secrets.PYPI_API_TOKEN }}
40-
repository_url: https://test.pypi.org/legacy/

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# An rMQR Code Generator
2-
![Lorem_ipsum](https://user-images.githubusercontent.com/14174940/171996095-4707be09-506e-4ef2-ab90-9942d6efc2ed.png)
2+
![reop-url](https://user-images.githubusercontent.com/14174940/172978619-accbf9d0-9dd8-4b19-b47e-ad139a68dcc9.png)
33

4-
This is an rMQR Code image generator implemented in Python.
4+
5+
This is an rMQR Code image generator implemented in Python. This is implemented based on [ISO/IEC 23941:2022](https://www.iso.org/standard/77404.html).
56

67
## Important Notice
78
Please verify an image generated by this software whether it can decode correctly before use.

example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def main():
2222
# print(qr)
2323

2424
# Save as png
25-
image = QRImage(qr)
25+
image = QRImage(qr, module_size=8)
2626
image.show()
2727
image.save("my_qr.png")
2828

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = rmqrcode
3-
version = 0.0.7
3+
version = 0.1.0
44
author = Takahiro Tomita
55
author_email = ttp8101@gmail.com
66
description = An rMQR Code Generetor

src/rmqrcode/qr_image.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
from .enums.color import Color
22

33
from PIL import Image
4+
from PIL import ImageDraw
45

56

67
class QRImage:
7-
def __init__(self, qr):
8-
self._img = Image.new('RGB', (qr.width() + 4, qr.height() + 4), (255, 255, 255))
8+
def __init__(self, qr, module_size=10):
9+
self._module_size = module_size
10+
self._img = Image.new(
11+
'RGB',
12+
((qr.width() + 4) * module_size, (qr.height() + 4) * module_size),
13+
(255, 255, 255)
14+
)
915
self._make_image(qr)
1016

1117

@@ -19,11 +25,15 @@ def save(self, name):
1925

2026

2127
def _make_image(self, qr):
28+
draw = ImageDraw.Draw(self._img)
2229
for y in range(qr.height()):
2330
for x in range(qr.width()):
2431
r, g, b = 125, 125, 125
2532
if qr.value_at(x, y) == Color.BLACK:
2633
r, g, b = 0, 0, 0
2734
elif qr.value_at(x, y) == Color.WHITE:
2835
r, g, b, = 255, 255, 255
29-
self._img.putpixel((x+2, y+2), (r, g, b))
36+
draw.rectangle(
37+
xy=((x + 2) * self._module_size, (y + 2) * self._module_size, (x + 1 + 2) * self._module_size, (y + 1 + 2) * self._module_size),
38+
fill=(r, g, b)
39+
)

0 commit comments

Comments
 (0)