def parse_image(data, width, height, flip_h=False, flip_v=False): img = bytearray() for x, y, i in iter.iter_image_indexes(width, height, 2, 1, flip_h, flip_v): img += bytes(unpack_color(data[i:])) return img
def parse_image(data, width, height, flip_h=False, flip_v=False): img_data = bytearray() for x, y, i in iter.iter_image_indexes(width, height, 0.5, 1, flip_h, flip_v): img_data.append(data[i] >> 4) img_data.append(data[i] & 0xF) return img_data
def parse_image(data, width, height, flip_h=False, flip_v=False): # hot path if not flip_h and not flip_v: return data flipped_data = bytearray() for x, y, i in iter.iter_image_indexes(width, height, 1, 1, flip_h, flip_v): flipped_data.append(data[i]) return flipped_data
def parse_image(data, width, height, flip_h=False, flip_v=False): img = bytearray() for x, y, i in iter.iter_image_indexes(width, height, 0.5, 1, flip_h, flip_v): b = data[i] i1 = (b >> 4) & 0xF i2 = b & 0xF i1 = ceil(0xFF * (i1 / 15)) i2 = ceil(0xFF * (i2 / 15)) img += bytes((i1, i2)) return img
def parse_image(data, width, height, flip_h=False, flip_v=False): img = bytearray() for x, y, i in iter.iter_image_indexes( width, height, flip_h=flip_h, flip_v=flip_v ): b = data[i] i = (b >> 4) & 0xF a = b & 0xF i = ceil(0xFF * (i / 15)) a = ceil(0xFF * (a / 15)) img += bytes((i, a)) return img
def parse_image(data, width, height, flip_h=False, flip_v=False): img = bytearray() for x, y, i in iter.iter_image_indexes(width, height, 0.5, 1, flip_h, flip_v): b = data[i] h = (b >> 4) & 0xF l = b & 0xF i1 = (h >> 1) & 0xF a1 = (h & 1) * 0xFF i1 = ceil(0xFF * (i1 / 7)) i2 = (l >> 1) & 0xF a2 = (l & 1) * 0xFF i2 = ceil(0xFF * (i2 / 7)) img += bytes((i1, a1, i2, a2)) return img