summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-11-18 17:57:07 -0500
committeryenatch <yenatch@gmail.com>2013-11-18 17:57:07 -0500
commit7fa921eb65d71f8ecf2527838090c69aa6d6ac64 (patch)
treefb529a5da313adb9b95667baeec20aac8fe56dce
parent125a58fb9ae4ff9b5ac3329c8716d52685272532 (diff)
gfx: direct png-to-1bpp
-rw-r--r--pokemontools/gfx.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/pokemontools/gfx.py b/pokemontools/gfx.py
index ca14d58..141f27e 100644
--- a/pokemontools/gfx.py
+++ b/pokemontools/gfx.py
@@ -1418,6 +1418,19 @@ def export_1bpp_to_png(filename, fileout=None):
w.write(f, px_map)
+def export_png_to_1bpp(filename, fileout=None):
+ image = png_to_1bpp(filename)
+
+ if fileout == None:
+ fileout = os.path.splitext(filename)[0] + '.1bpp'
+
+ to_file(fileout, image)
+
+def png_to_1bpp(filename):
+ image, palette = png_to_2bpp(filename)
+ return convert_2bpp_to_1bpp(image)
+
+
def mass_to_png(debug=False):
# greyscale
for root, dirs, files in os.walk('./gfx/'):
@@ -1609,6 +1622,9 @@ if __name__ == "__main__":
elif argv[1] == 'png-to-2bpp':
export_png_to_2bpp(argv[2])
+ elif argv[1] == 'png-to-1bpp':
+ export_png_to_1bpp(argv[2])
+
elif argv[1] == '2bpp-to-lz':
if argv[2] == '--vert':
filein = argv[3]