Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79a41f5

Browse files
committed
edited generate/read qr code tutorial
1 parent2374634 commit79a41f5

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
importqrcode
2+
importnumpyasnp
3+
# data to encode
4+
data="https://www.thepythoncode.com"
5+
6+
# instantiate QRCode object
7+
qr=qrcode.QRCode(version=1,box_size=10,border=4)
8+
# add data to the QR code
9+
qr.add_data(data)
10+
# compile the data into a QR code array
11+
qr.make()
12+
# print the image shape
13+
print("The shape of the QR image:",np.array(qr.get_matrix()).shape)
14+
# transfer the array into an actual image
15+
img=qr.make_image(fill_color="white",back_color="black")
16+
# save it to a file
17+
img.save("site_inversed.png")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
opencv-python
2-
qrcode
2+
qrcode
3+
numpy
-243 Bytes
Loading
455 Bytes
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp