#!/usr/bin/env python3 from PIL import Image dest_x = 10 * 64 dest_y = 4 * 80 pixels = \ [" XXXX ", " XX@@@@XX ", " XX@@@@@@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@XXXX XXXX@@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXXXXXX @@@@XX ", "XX@@@@ X X @@@@XX", " XX@@@@ XXXXXXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@ XXXX XXXX @@@@XX ", " XX@@@@XXXX XXXX@@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@ @@@@XX ", " XX@@@@@@@@XX ", " XX@@@@XX ", " XXXX ", ] im = Image.new("RGBA", (dest_x, dest_y), (0, 0, 0, 0)) im.save("empty_RGBA_{}_{}.png".format(dest_x, dest_y)) y = 80 - len(pixels) for line in pixels: for x in range(64): if line[x] == ' ': p = (0,0,0,0) else: p = (200, 200, 200, 255) for dx in range(0, dest_x, 64): for dy in range(0, dest_y, 80): im.putpixel((dx+x, dy+y), p) y = y + 1 im.save('template_RGBA_{}_{}.png'.format(dest_x, dest_y))