summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/cli/painter/convert_graphics.py
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2022-11-28 07:54:00 +1100
committerNick Brassel <nick@tzarc.org>2022-11-28 07:54:00 +1100
commit4020674163fc80914059c4c9c3be5c0ae00bd150 (patch)
tree6f4187d72b04d03572adf507502afbda9726d696 /lib/python/qmk/cli/painter/convert_graphics.py
parent8f9b49dc5b05fd3421e47aa76822a5b2199dfca6 (diff)
parent9e78e65a566487b2f4fe7b663971a01deb6ddad2 (diff)
Merge remote-tracking branch 'upstream/develop'
Diffstat (limited to 'lib/python/qmk/cli/painter/convert_graphics.py')
-rw-r--r--lib/python/qmk/cli/painter/convert_graphics.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/painter/convert_graphics.py b/lib/python/qmk/cli/painter/convert_graphics.py
index bbc30d26ff..2519c49b25 100644
--- a/lib/python/qmk/cli/painter/convert_graphics.py
+++ b/lib/python/qmk/cli/painter/convert_graphics.py
@@ -15,6 +15,7 @@ from PIL import Image
@cli.argument('-f', '--format', required=True, help='Output format, valid types: %s' % (', '.join(valid_formats.keys())))
@cli.argument('-r', '--no-rle', arg_only=True, action='store_true', help='Disables the use of RLE when encoding images.')
@cli.argument('-d', '--no-deltas', arg_only=True, action='store_true', help='Disables the use of delta frames when encoding animations.')
+@cli.argument('-w', '--raw', arg_only=True, action='store_true', help='Writes out the QGF file as raw data instead of c/h combo.')
@cli.subcommand('Converts an input image to something QMK understands')
def painter_convert_graphics(cli):
"""Converts an image file to a format that Quantum Painter understands.
@@ -53,6 +54,12 @@ def painter_convert_graphics(cli):
input_img.save(out_data, "QGF", use_deltas=(not cli.args.no_deltas), use_rle=(not cli.args.no_rle), qmk_format=format, verbose=cli.args.verbose)
out_bytes = out_data.getvalue()
+ if cli.args.raw:
+ raw_file = cli.args.output / (cli.args.input.stem + ".qgf")
+ with open(raw_file, 'wb') as raw:
+ raw.write(out_bytes)
+ return
+
# Work out the text substitutions for rendering the output data
subs = {
'generated_type': 'image',
[cgit] Unable to lock slot /tmp/cgit/b8000000.lock: Permission denied (13)