New size of pictures for better speed

This commit is contained in:
2026-05-08 14:03:40 +03:00
parent 6a2c0d0d35
commit 9107ba1199
2 changed files with 7 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ def create_datamatrix_in_memory(raw_bytes: bytes) -> ImageReader:
)
# Очищаем картинку для термопринтера (убираем сглаживание)
img = img.resize((img.width * 10, img.height * 10), Image.Resampling.NEAREST)
img = img.resize((img.width * 5, img.height * 5), Image.Resampling.NEAREST)
return ImageReader(img)
@@ -236,7 +236,7 @@ def draw_label_page(c: canvas.Canvas, font_name: str, dm_image: ImageReader, lab
# =========================================================
# DataMatrix (крупный квадрат слева сверху)
img_size = 23 * mm
img_x = 2 * mm
img_x = 4 * mm
img_y = label_height - img_size - 2 * mm # Верхний левый угол
c.drawImage(dm_image, img_x, img_y, width=img_size, height=img_size)
@@ -282,13 +282,13 @@ def draw_label_page(c: canvas.Canvas, font_name: str, dm_image: ImageReader, lab
# 7. EAN Текст (самый низ)
ean_text_h = 2.5 * mm
ean_text_y = 1 * mm
ean_text_y = 3 * mm
place_text(c, f"{label_data.ean}", font_name,
x=right_x, y=ean_text_y, width=right_w, height=ean_text_h,
font_size=6, font_type='regular', align='center', auto_resize=True)
# 6. EAN Штрихкод (Серый прямоугольник-заглушка)
ean_barcode_h = 9 * mm
ean_barcode_h = 8 * mm
ean_barcode_y = ean_text_y + ean_text_h
code128_image = render_code128(label_data.ean)
c.drawImage(code128_image, right_x, ean_barcode_y, width=right_w, height=ean_barcode_h)
@@ -300,21 +300,21 @@ def draw_label_page(c: canvas.Canvas, font_name: str, dm_image: ImageReader, lab
art_y = ean_barcode_y + ean_barcode_h
place_text(c, f"арт.: {label_data.article}", font_name,
x=right_x, y=art_y, width=right_w, height=art_h,
font_size=7, font_type='bold', align='center')
font_size=7, font_type='bold', align='center', auto_resize=True)
# 4. Размер (одна строка, жирно)
size_h = 3 * mm
size_y = art_y + art_h
place_text(c, f"размер: {label_data.size}", font_name,
x=right_x, y=size_y, width=right_w, height=size_h,
font_size=7, font_type='bold', align='center')
font_size=7, font_type='bold', align='center', auto_resize=True)
# 3. Цвет (одна строка, жирно)
color_h = 3 * mm
color_y = size_y + size_h
place_text(c, f"цвет: {label_data.color}", font_name,
x=right_x, y=color_y, width=right_w, height=color_h,
font_size=7, font_type='bold', align='center')
font_size=7, font_type='bold', align='center', auto_resize=True)
# 2. Описание (Крупно, жирно, центр, занимает всё среднее пространство)
desc_h = 13 * mm