1

With Java, a grayscale image from an array with (32-bit floating point) values. Could I use BMP or PGM? What its the best image format with no compression for this array with these (32-bit floating point) values?

rtruszk
  • 3,902
  • 13
  • 36
  • 53

1 Answers1

2

There's a variant of PGM called PFM (in Pf mode for grayscale) that supports IEEE 32 bit floating point samples.

You could also store these images in an uncompressed TIFF file too. I'm not sure what software does support floating point TIFFs though, as this is certainly outside of "Baseline" TIFF.

BMP is not suitable for floating point.

I have a Java ImageIO plugin that reads PFM, and it's not too hard to extend it to write I guess. If your task is to implement read/write yourself, I'd certainly choose the PFM format, for simplicity.

I also have a TIFF plugin (available on the same link), but it doesn't support floating point sample format (TIFF sample format 3) yet. Feel free to propose such a feature, and supply a few sample images for test purposes.

Harald K
  • 26,314
  • 7
  • 65
  • 111