From 9007b587a3e843106b09cf2cd9e1a7bfae513e75 Mon Sep 17 00:00:00 2001 From: yenatch Date: Sat, 19 Apr 2014 02:40:11 -0400 Subject: Transpose images by height from 2bpp to png and width from png to 2bpp. Transposing non-square images would work over the expected width, rather than the current width (the expected height). This never came up since transposed images are typically square. --- pokemontools/gfx.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pokemontools/gfx.py b/pokemontools/gfx.py index 244b0e3..92cc0c1 100644 --- a/pokemontools/gfx.py +++ b/pokemontools/gfx.py @@ -67,6 +67,11 @@ def transpose(tiles, width=None): 12 13 14 15 16 17 03 09 0f 15 1b 21 18 19 1a 1b 1c 1d 04 0a 10 16 1c 22 1e 1f 20 21 22 23 05 0b 11 17 1d 23 + + 00 01 02 03 00 04 08 + 04 05 06 07 <-> 01 05 09 + 08 09 0a 0b 02 06 0a + 03 07 0b """ if width == None: width = int(sqrt(len(tiles))) # assume square image @@ -1377,7 +1382,7 @@ def convert_2bpp_to_png(image, **kwargs): pic = [] for i in xrange(0, len(image) - trailing, pic_length): - pic += transpose_tiles(image[i:i+pic_length], w) + pic += transpose_tiles(image[i:i+pic_length], h) image = ''.join(pic) + image[len(image) - trailing:] # Pad out trailing lines. -- cgit v1.2.3