diff options
author | yenatch <yenatch@gmail.com> | 2014-04-19 02:40:11 -0400 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2014-04-19 02:54:21 -0400 |
commit | 9007b587a3e843106b09cf2cd9e1a7bfae513e75 (patch) | |
tree | 50ba31a6ccef46528403148bbb182133a3136a49 /pokemontools/gfx.py | |
parent | 698b0fc7e63d3dadf07247015e230bce145cc500 (diff) |
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.
Diffstat (limited to 'pokemontools/gfx.py')
-rw-r--r-- | pokemontools/gfx.py | 7 |
1 files changed, 6 insertions, 1 deletions
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. |