Skip to content

Commit

Permalink
-Change: move split_string to save_pictures.py
Browse files Browse the repository at this point in the history
  • Loading branch information
miniupnp committed Apr 14, 2018
1 parent edb8cd8 commit f39b188
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tools/extractsprites.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

palette = None

split_string = lambda s, n: [s[i*n:i*n+n] for i, j in enumerate(s[::n])]

def load_palette(filename):
global palette
with open(filename, 'rb') as pal_file:
Expand Down
3 changes: 3 additions & 0 deletions tools/save_pictures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

from struct import pack

def split_string(s, n):
return [s[i*n:i*n+n] for i, j in enumerate(s[::n])]

def save_pbm(filename, width, height, pixels, palette):
if (width & 1) != 0:
pixels = ''.join([line + chr(0) for line in split_string(pixels, width)])
Expand Down

0 comments on commit f39b188

Please sign in to comment.