How to convert numpy array into image and add it to images inside bpy I have a numpy array which I'd like map onto a cube inside blender. Is there a way to make texture out of it, without writing to file? This array will change over time and writing to disk and reading it again seems very slow and also in future I might have many numpy arrays to texture the cube. 

Bonus question:) Is it possible to do this without PIL in the middle?
Here is example TestImg to which we write numpy array (in this example it is all zeros). Thing to remember if image size is 100px width 100px height, and 4 channels then numpy array size must be 100*100*4. eg:

numpy.zeroes((100,100,4), dtype = float16)


Example

if "TestImg.png" not in bpy.data.images.keys():
    bpy.data.images.new("TestImg.png", width=128, height=128, alpha=True, float_buffer=False)
outputImg = bpy.data.images["TestImg.png"] 
input_res = int(math.sqrt(outputImg.size[0]))
np_out_img = np.zeros((input_res,input_res,4), dtype = np.float16)
outputImg.pixels = np_out_img.ravel()  #flatten the array to 1 dimension and write it to testImg pixels