make_img.py
308 Bytes
from numpy import array, savetxt
from PIL import Image
import sys
import picamera
camera = picamera.PiCamera()
filename = 'image.jpg'
camera.capture(filename)
img = array(Image.open(filename).resize((32,32), Image.ANTIALIAS)).transpose(2,0,1).flatten()
savetxt('input.txt', img, fmt='%d', delimiter=' ')