Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further GravityJack improvements. #6

Open
wants to merge 6 commits into
base: GravityJack-improvements
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pystrich/code128/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def __init__(self, bars, text, options=None):
* label_border: number of pixels space between the barcode and the label
* bottom_border: number of pixels space between the label and the bottom border
* height: height of the image in pixels
* show_label: whether to show the label below the barcode (defaults to True) """
* show_label: whether to show the label below the barcode (defaults to True)
* quiet_width_multiplier: size of the quiet width in units of bar width (default 10)"""
self.options = options or {}
self.bars = bars
self.text = text
Expand All @@ -41,14 +42,15 @@ def get_pilimage(self, bar_width):
"""Return the barcode as a PIL object"""

show_label = self.options.get('show_label', True)
quiet_width_muliplier = self.options.get('quiet_width_multiplier', 10)

# 11 bars per character, plus the stop
num_bars = len(self.bars)

log.debug("There are %d bars", num_bars)

# Quiet zone is 10 bar widths on each side
quiet_width = bar_width * 10
quiet_width = bar_width * quiet_width_muliplier

fontsize = 0
if show_label:
Expand Down