mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2025-08-13 02:08:46 +00:00
New Firmware and Python Script
This commit is contained in:
19
PYTHON/CreateMatrix.py
Normal file
19
PYTHON/CreateMatrix.py
Normal file
@@ -0,0 +1,19 @@
|
||||
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()
|
Reference in New Issue
Block a user