hi there,
I am trying to read and decode astrophysics images coming out of a telescope.
the image payload is stored as a big-endian encoded slice of float32.
the python doc only vaguely defines that format:
(search for "32-bit floating point pixels")
re-engineering the bytes output of an f32-pixels image converted to rgba via the python tools, I came up with this:
floats := make([]float32, size)
err = binary.Read(raw, binary.BigEndian, floats)
pix := make([]byte, 4*size)
for i,v := range floats {
ii := i*4
pix[ii+0] = byte(v)
pix[ii+1] = byte(v)
pix[ii+2] = byte(v)
pix[ii+3] = 255
}
img := image.NewNRGBA(rect)
img.Pix = pix
but it seems a bit strange to me (and the resulting image looks slightly different, perhaps due to some saturation my code doesn't handle properly?)
has anyone encountered this kind of float32-pixels ?
(and, bonus points, already implemented an image.Image for this?)
-s