How to Create .fits file from numpy array
问题 I am currently trying to convert a .cr2 into .fits file. I am currently unable to create .fits as any file I create doesn't open or work because of the wrong shape of fits. I have tried using the solution Write 3d Numpy array to FITS file with Astropy but, still, it doesn't work. import numpy as np from astropy.io import fits im = imageio.imread(r'E:\FYP\cr.cr2', format="RAW-FI") a = np.array(im) print (a.shape) hdu = fits.PrimaryHDU(a) hdulist = fits.HDUList([hdu]) hdulist.writeto(r'E:\FYPcr