brother_ql_create: new CLI parameter --dither
This commit is contained in:
@@ -63,7 +63,7 @@ giving:
|
|||||||
|
|
||||||
usage: brother_ql_create [-h] [--model MODEL] [--label-size LABEL_SIZE]
|
usage: brother_ql_create [-h] [--model MODEL] [--label-size LABEL_SIZE]
|
||||||
[--rotate {0,90,180,270}] [--threshold THRESHOLD]
|
[--rotate {0,90,180,270}] [--threshold THRESHOLD]
|
||||||
[--no-cut] [--loglevel LOGLEVEL]
|
[--dither] [--no-cut] [--loglevel LOGLEVEL]
|
||||||
image [outfile]
|
image [outfile]
|
||||||
|
|
||||||
positional arguments:
|
positional arguments:
|
||||||
@@ -85,6 +85,8 @@ giving:
|
|||||||
--threshold THRESHOLD, -t THRESHOLD
|
--threshold THRESHOLD, -t THRESHOLD
|
||||||
The threshold value (in percent) to discriminate
|
The threshold value (in percent) to discriminate
|
||||||
between black and white pixels.
|
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.
|
--no-cut Don't cut the tape after printing the label.
|
||||||
--loglevel LOGLEVEL Set to DEBUG for verbose debugging output to stderr.
|
--loglevel LOGLEVEL Set to DEBUG for verbose debugging output to stderr.
|
||||||
|
|
||||||
|
|||||||
@@ -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('--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('--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('--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('--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.')
|
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()
|
args = parser.parse_args()
|
||||||
@@ -52,7 +53,7 @@ def main():
|
|||||||
|
|
||||||
qlr.exception_on_warning = True
|
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)
|
args.outfile.write(qlr.data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user