diff options
| author | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-12-29 09:05:35 (GMT) |
|---|---|---|
| committer | Daniel Thompson <daniel@redfelineninja.org.uk> | 2020-12-29 09:05:35 (GMT) |
| commit | 4425d8148562faf9093dca3715e5cf1eabc5e104 (patch) | |
| tree | ba1cba0ee3e0c40c22ee8c5b1461ebb68f0db7f0 /tools | |
| parent | 0318640f620d75098ccf535fea30f716ea625515 (diff) | |
tools: rle_encode: Add a parameter for direct CLUT lookup
This can be useful for hand decoding and authoring of images.
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/rle_encode.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/rle_encode.py b/tools/rle_encode.py index 510250b..b96ac62 100755 --- a/tools/rle_encode.py +++ b/tools/rle_encode.py @@ -342,12 +342,14 @@ def decode_to_ascii(image): assert(dp == 0) parser = argparse.ArgumentParser(description='RLE encoder tool.') -parser.add_argument('files', nargs='+', +parser.add_argument('files', nargs='*', help='files to be encoded') parser.add_argument('--ascii', action='store_true', help='Run the resulting image(s) through an ascii art decoder') parser.add_argument('--c', action='store_true', help='Render the output as C instead of python') +parser.add_argument('--clut', default=0, type=int, + help='Lookup a colour value in the CLUT') parser.add_argument('--indent', default=0, type=int, help='Add extra indentation in the generated code') parser.add_argument('--1bit', action='store_const', const=1, dest='depth', @@ -358,6 +360,10 @@ parser.add_argument('--8bit', action='store_const', const=8, dest='depth', help='Generate 8-bit image') args = parser.parse_args() + +if args.clut: + print(f'{args.clut} maps to {clut8_rgb888(args.clut):06x} (RGB888) or {clut8_rgb565(args.clut):04x} (RGB565)') + if args.depth == 8: encoder = encode_8bit elif args.depth == 2: |
