I am trying to reduce my cannon astro images by taking off the flatframe, which works. But it leaves all the values very low (so almost black picture), which is why I also want to multiply it with the average. However this gives me an error. (while without multiplication it works.)
Does anybody know why?
Traceback (most recent call last): File "D:\astro\10-12\moon\fits\red.py", line 16, in img = Image.fromarray(imarray) File "C:\Python27\lib\site-packages\PIL\Image.py", line 1886, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type
Here is my code
import Image
import numpy as np
im = Image.open('8bit/DPP_0001.TIF')
flat = Image.open('8bit/flat2.TIF')
#im.show()
imarray = np.array(im)
flatarray = np.array(flat)
avg = np.average(imarray)
imarray = (imarray/flatarray)*avg
img = Image.fromarray(imarray)
img.save("done/aap.png","png")