brother_ql_create: new CLI parameter --dither

This commit is contained in:
Philipp Klaus
2017-09-17 20:44:08 +02:00
parent d681d0ee9c
commit 11227c0db6
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -63,7 +63,7 @@ giving:
usage: brother_ql_create [-h] [--model MODEL] [--label-size LABEL_SIZE]
[--rotate {0,90,180,270}] [--threshold THRESHOLD]
[--no-cut] [--loglevel LOGLEVEL]
[--dither] [--no-cut] [--loglevel LOGLEVEL]
image [outfile]
positional arguments:
@@ -85,6 +85,8 @@ giving:
--threshold THRESHOLD, -t THRESHOLD
The threshold value (in percent) to discriminate
between black and white pixels.
--dither, -d Enable dithering when converting the image to b/w. If
set, --threshold is meaningless.
--no-cut Don't cut the tape after printing the label.
--loglevel LOGLEVEL Set to DEBUG for verbose debugging output to stderr.
+2 -1
View File
@@ -31,6 +31,7 @@ def main():
parser.add_argument('--label-size', '-s', default='62', help='The label size (and kind) to use. Check available ones with `brother_ql_info list-label-sizes`.')
parser.add_argument('--rotate', '-r', choices=('0', '90', '180', '270'), default='auto', help='Rotate the image (counterclock-wise) by this amount of degrees.')
parser.add_argument('--threshold', '-t', type=float, default=70.0, help='The threshold value (in percent) to discriminate between black and white pixels.')
parser.add_argument('--dither', '-d', action='store_true', help='Enable dithering when converting the image to b/w. If set, --threshold is meaningless.')
parser.add_argument('--no-cut', dest='cut', action='store_false', help="Don't cut the tape after printing the label.")
parser.add_argument('--loglevel', type=lambda x: getattr(logging, x), default=logging.WARNING, help='Set to DEBUG for verbose debugging output to stderr.')
args = parser.parse_args()
@@ -52,7 +53,7 @@ def main():
qlr.exception_on_warning = True
create_label(qlr, args.image, args.label_size, threshold=args.threshold, cut=args.cut, rotate=args.rotate)
create_label(qlr, args.image, args.label_size, threshold=args.threshold, cut=args.cut, rotate=args.rotate, dither=args.dither)
args.outfile.write(qlr.data)