Guest User

Untitled

a guest
Jun 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def RGBA8(self, (w, h), jar): out = [[0 for i in range(w * 4)] for i in range(h)] i = 0 for y in range(0, h, 4): for x in range(0, w, 4): for iv in range(2): for y1 in range(y, y + 4): for x1 in range(x, x + 4): if(y1 >= h or x1 >= w): continue pixel = jar[i] i += 1 if(iv == 0): r = (pixel >> 0) & 0xFF a = (pixel >> 8) & 0xFF out[y1][(x1 * 4) + 0] = r out[y1][(x1 * 4) + 3] = a else: g = (pixel >> 8) & 0xFF b = (pixel >> 0) & 0xFF out[y1][(x1 * 4) + 1] = g out[y1][(x1 * 4) + 2] = b
Add Comment
Please, Sign In to add comment