Update to_png.py

Default > delete bmp
This commit is contained in:
2026-06-02 23:18:30 +00:00
parent 6f1ea20242
commit df5612b096
+6 -1
View File
@@ -10,7 +10,7 @@ pixel to fully transparent, and writes a PNG.
Usage:
python3 to_png.py [dir ...] # default: all gfx*_extracted dirs
python3 to_png.py --key RRGGBB ... # custom colorkey (hex), default 000000
python3 to_png.py --keep # keep .bmp files (default keeps them)
python3 to_png.py --keep # keep .bmp files (default deletes them)
"""
import sys, os, glob
from PIL import Image
@@ -30,6 +30,7 @@ def convert(path, key):
def main():
args = sys.argv[1:]
key = (0, 0, 0)
keep = False
dirs = []
i = 0
while i < len(args):
@@ -37,6 +38,8 @@ def main():
h = args[i+1].lstrip('#')
key = (int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16))
i += 2
elif args[i] == '--keep':
keep = True; i += 1
else:
dirs.append(args[i]); i += 1
if not dirs:
@@ -47,6 +50,8 @@ def main():
for b in bmps:
try:
convert(b, key)
if not keep:
os.remove(b)
total += 1
except Exception as ex:
print(' ERROR %s: %s' % (b, ex))