summaryrefslogtreecommitdiff
path: root/barcode_gen.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-06-22 13:44:33 +0200
committerjaseg <git@jaseg.de>2024-06-22 13:44:33 +0200
commit351ba0a77a5187f66102fcfb2b2c3991de30c5e5 (patch)
tree54f384df3e08e4dfe18d8672155f22718f4a12fa /barcode_gen.py
parent565e0821d9139d57afc1fc293575df067bde5503 (diff)
downloadbarcode-351ba0a77a5187f66102fcfb2b2c3991de30c5e5.tar.gz
barcode-351ba0a77a5187f66102fcfb2b2c3991de30c5e5.tar.bz2
barcode-351ba0a77a5187f66102fcfb2b2c3991de30c5e5.zip
Fix width calculation
Diffstat (limited to 'barcode_gen.py')
-rw-r--r--barcode_gen.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/barcode_gen.py b/barcode_gen.py
index dc000bf..c8d16bb 100644
--- a/barcode_gen.py
+++ b/barcode_gen.py
@@ -91,8 +91,7 @@ def cli(data, outfile, height, text, font, font_size, bar_width, margin, color,
])
data_encoded = [True, False, True, False, *data_encoded, False, True, True, False, True]
- bars = 32/2*3 + 2
- width = bars * bar_width
+ width = len(data_encoded) * bar_width
# 1 px = 0.75 pt
pt_to_mm = lambda pt: pt / 0.75 /dpi * 25.4
font_size = pt_to_mm(font_size)