Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB |
@@ -260,7 +260,7 @@ while while_loop:
|
||||
text_draw = ImageDraw.Draw(image)
|
||||
text_draw.text((x_position, y_position), FeatureByte, fill=text_color, font=font)
|
||||
# 保存生成的图像
|
||||
#image.save("barcodes.png")
|
||||
image.save("database/"+sn+".png")
|
||||
|
||||
# 显示图像(可选)
|
||||
image.show()
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
|
||||
|
||||
block_cipher = None
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['begin.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='begin',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
runtime_tmpdir=None,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
icon=['logo.ico'],
|
||||
)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg
|
||||
PUBLIC '-//W3C//DTD SVG 1.1//EN'
|
||||
'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="25.280mm" height="23.764mm">
|
||||
<!--Autogenerated with python-barcode 0.15.1-->
|
||||
<g id="barcode_group">
|
||||
<rect width="100%" height="100%" style="fill:white"/>
|
||||
<rect x="2.540mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="3.140mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="3.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="4.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="5.340mm" y="1.000mm" width="0.600mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="6.340mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="6.940mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="7.740mm" y="1.000mm" width="0.600mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="8.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="9.140mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="9.940mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="10.340mm" y="1.000mm" width="0.600mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="11.340mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="11.940mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="12.340mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="13.540mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="13.940mm" y="1.000mm" width="0.800mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="15.140mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="15.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="16.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="17.340mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="17.940mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="18.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="19.740mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="20.140mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="21.140mm" y="1.000mm" width="0.600mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="21.940mm" y="1.000mm" width="0.200mm" height="15.000mm" style="fill:black;"/>
|
||||
<rect x="22.340mm" y="1.000mm" width="0.400mm" height="15.000mm" style="fill:black;"/>
|
||||
<text x="12.640mm" y="21.000mm" style="fill:black;font-size:10pt;text-anchor:middle;">123asd</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -1,71 +0,0 @@
|
||||
from PIL import Image, ImageDraw,ImageFont
|
||||
from barcode import Code128
|
||||
from barcode.writer import ImageWriter
|
||||
import qrcode
|
||||
|
||||
# 定义图像大小和条形码大小
|
||||
image_width = 2479
|
||||
image_height = 3508
|
||||
qrcode_size = 250
|
||||
# 创建一个空白图像
|
||||
image = Image.new("RGB", (image_width, image_height), (255, 255, 255))
|
||||
draw = ImageDraw.Draw(image)
|
||||
|
||||
# 条形码配置
|
||||
barcode_options = {
|
||||
"writer": ImageWriter(),
|
||||
"output": 'temp', # 输出格式,可以是文件名或字节流
|
||||
}
|
||||
|
||||
# 在图像上生成多个条形码并放置它们
|
||||
x_position = 50
|
||||
y_position = 50
|
||||
|
||||
|
||||
# 生成条形码
|
||||
barcode = Code128("test", writer=barcode_options["writer"])
|
||||
barcode_file = barcode.save(barcode_options["output"])
|
||||
|
||||
# 打开生成的条形码图像
|
||||
barcode_image = Image.open(barcode_file)
|
||||
|
||||
# 将条形码添加到图像上
|
||||
image.paste(barcode_image, (x_position, y_position))
|
||||
|
||||
# 更新下一个条形码的位置
|
||||
y_position += 120
|
||||
|
||||
# 在条形码下方添加自定义文本
|
||||
custom_text = "Custom Text 123"
|
||||
text_color = (0, 0, 0) # 文本颜色(黑色)
|
||||
# 设置字体大小
|
||||
font_size = 100
|
||||
font = ImageFont.truetype("fonts/arial", font_size) # 替换为你自己的字体文件路径
|
||||
|
||||
# 创建一个Draw对象并将文本添加到图像上
|
||||
text_draw = ImageDraw.Draw(image)
|
||||
text_draw.text((x_position, y_position + 120), custom_text, fill=text_color, font=font)
|
||||
|
||||
# 更新下一个条形码的位置
|
||||
y_position += 220
|
||||
|
||||
|
||||
# 生成二维码
|
||||
qr = qrcode.QRCode(
|
||||
version=1,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_L,
|
||||
box_size=10,
|
||||
border=4,
|
||||
)
|
||||
qr.add_data("QR Code Data456")
|
||||
qr.make(fit=True)
|
||||
|
||||
qr_image = qr.make_image(fill_color="black", back_color="white").resize((qrcode_size, qrcode_size))
|
||||
|
||||
# 将二维码添加到图像上
|
||||
image.paste(qr_image, (x_position, y_position))
|
||||
# 保存生成的图像
|
||||
#image.save("barcodes.png")
|
||||
|
||||
# 显示图像(可选)
|
||||
image.show()
|
||||
Reference in New Issue
Block a user