Skip to content

Commit

Permalink
Update bmc-tools.py
Browse files Browse the repository at this point in the history
  • Loading branch information
noamlif committed Apr 20, 2020
1 parent 65b7201 commit 0d0e125
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bmc-tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,13 @@ def b_export(self, dname):
w = self.STRIPE_WIDTH*64
h*=len(self.bmps)/self.STRIPE_WIDTH
c_bmp = "" if not self.pal else self.PALETTE
for i in range(h/64):
for j in range(64):
for k in range(w/64):
if self.btype == self.BIN_CONTAINER:
c_bmp+=self.bmps[self.STRIPE_WIDTH*(i+1)-1-k][64*len(pad)*j:64*len(pad)*(j+1)]
else:
c_bmp+=self.bmps[self.STRIPE_WIDTH*i+k][64*len(pad)*j:64*len(pad)*(j+1)]
if self.btype == self.BIN_CONTAINER:
collage_builder = (lambda x, a=self, PAD=len(pad), WIDTH=range(int(w / 64)): ''.join([''.join([a.bmps[a.STRIPE_WIDTH*(x+1)-1-k][64*PAD*j:64*PAD*(j+1)] for k in WIDTH]) for j in range(64)]))
else:
collage_builder = (lambda x, a=self, PAD=len(pad), WIDTH=range(int(w / 64)): ''.join([''.join([a.bmps[a.STRIPE_WIDTH*x+k][64*PAD*j:64*PAD*(j+1)] for k in WIDTH]) for j in range(64)]))

c_bmp += ''.join(map(collage_builder, range(int(h/64))))
print c_bmp[:300]
self.b_write(os.path.join(dname, "%s_collage.bmp" % (self.fname)), self.b_export_bmp(w, h, c_bmp))
self.b_log(sys.stdout, False, 0, "Successfully exported collage file.")
return True
Expand Down

0 comments on commit 0d0e125

Please sign in to comment.