def decode_en_tiny(tiles, name): img_tiles = list(Pixmap((8,8), tile) for tile in tiles) letters_n = len(img_tiles) // 2 img = Pixmap(IMGSIZE) # Each letter has 2 tiles for letter_i in range(0, letters_n): letter = Pixmap((8,16)) letter.paste(img_tiles[letter_i*2+0], (0,0)) letter.paste(img_tiles[letter_i*2+1], (0,8)) x = (letter_i % ROW_LETTERS) * 16 y = (letter_i // ROW_LETTERS) * 16 img.paste(letter.flip_lr(), (x,y)) img.save(name, PIXELCHARS)
def decode_jp_tiny(tiles, name): img_tiles = list(Pixmap((8,8), tile) for tile in tiles) letters_n = len(img_tiles) // 2 img = Pixmap(IMGSIZE) tilepairs = [] for i in range(0, len(img_tiles)//2): first = (i // 16) * 32 + (i % 16) second = first + 16 tilepair = (img_tiles[first], img_tiles[second]) tilepairs.append(tilepair) for letter_i in range(0, len(tilepairs)): letter = Pixmap((8,16)) letter.paste(tilepairs[letter_i][0], (0,0)) letter.paste(tilepairs[letter_i][1], (0,8)) x = (letter_i % ROW_LETTERS) * 16 y = (letter_i // ROW_LETTERS) * 16 img.paste(letter.flip_lr(), (x,y)) img.save(name, PIXELCHARS)
def decode_jp(tiles, name): img_tiles = list(Pixmap((8,8), tile) for tile in tiles) letters_n = (len(img_tiles)-2) // 4 img = Pixmap(IMGSIZE) tilepairs = [] for i in range(0, len(img_tiles)//2): first = (i // 16) * 32 + (i % 16) second = first + 16 tilepair = (img_tiles[first], img_tiles[second]) tilepairs.append(tilepair) # The first pair is missing in the original image tilepairs = [tilepairs[0]] + tilepairs for letter_i in range(0, len(tilepairs)//2): letter = Pixmap((16,16)) letter.paste(tilepairs[letter_i*2][0], (0,0)) letter.paste(tilepairs[letter_i*2][1], (0,8)) letter.paste(tilepairs[letter_i*2+1][0], (8,0)) letter.paste(tilepairs[letter_i*2+1][1], (8,8)) x = (letter_i % ROW_LETTERS) * 16 y = (letter_i // ROW_LETTERS) * 16 img.paste(letter.flip_lr(), (x,y)) img.save(name, PIXELCHARS)