I have a ndarray with floats in it I want to save. I would like to keep the values as float though. The only format I found that accepts saving float data is tiff. Doesn’t show the actual image however.
from Image import *
from numpy import *
img = random.random((300, 300)) #float numbers, i have actual data in my image though
img = fromarray(img)
img.save('test.tiff')
Your example is saving a floating-point TIFF file. I’ve confirmed by examining the TIFF header, noting that the samples per pixel tag 0x153 has a value of 3 (floating point data). Using your example:
Output:
Details on the TIFF6 file format
Updated: Example 64×64 image viewed on Mac desktop:
