summaryrefslogtreecommitdiff
path: root/gfx.py
diff options
context:
space:
mode:
authoryenatch <yenatch@github.com>2013-02-12 03:40:41 -0500
committeryenatch <yenatch@github.com>2013-02-12 03:40:41 -0500
commitaf678654e69eb7ad8fc4494529d2e0104aeec4f5 (patch)
tree119812dff3ece037918f1f68d25d9838ef3fb6d0 /gfx.py
parent61f08140d683fb8b939f23d10fbc77006830cc68 (diff)
Export any detected palettes to png by default
Checks for any palette using the same name as the 2bpp file. original-commit-id: 7f7f4612404b6c898d4cb50fb4468580dbd46910
Diffstat (limited to 'gfx.py')
-rw-r--r--gfx.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/gfx.py b/gfx.py
index d2e2abf..3aa98b3 100644
--- a/gfx.py
+++ b/gfx.py
@@ -1430,13 +1430,16 @@ def mass_to_png(debug=False):
to_png(os.path.join(root, name))
def mass_to_colored_png(debug=False):
- # greyscale
+ # greyscale, unless a palette is detected
for root, dirs, files in os.walk('../gfx/'):
if 'pics' not in root and 'trainers' not in root:
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
- to_png(os.path.join(root, name))
+ if name[:5]+'.pal' in files:
+ to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
+ else:
+ to_png(os.path.join(root, name))
# only monster and trainer pics for now
for root, dirs, files in os.walk('../gfx/pics/'):
@@ -1451,7 +1454,7 @@ def mass_to_colored_png(debug=False):
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
- to_png(os.path.join(root, name), None, os.path.join(root, name[:-5] + '.pal'))
+ to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
def mass_decompress(debug=False):