mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-12-25 14:32:40 +00:00
20 lines
391 B
Python
20 lines
391 B
Python
import sys
|
|
from PIL import Image
|
|
|
|
|
|
img = sys.argv[1]
|
|
size = 16, 16
|
|
|
|
im = Image.open(img)
|
|
smallim = im.resize(size, Image.ANTIALIAS);
|
|
smallim = smallim.convert('RGB')
|
|
pixels = list(smallim.getdata())
|
|
|
|
imgstr = str(pixels).strip('[]')
|
|
imgstr = imgstr.replace('(','{')
|
|
imgstr = imgstr.replace(')','}')
|
|
|
|
f = open(img + '.h', 'w')
|
|
f.write('int imageArray[256][3] = {' + imgstr + '};')
|
|
f.close()
|