What is a PFM File?
A Portable FloatMap file stores grayscale or RGB raster samples as floating-point values. Those samples can represent values outside the integer range commonly used for display images.
How PFM Files work
PFM puts a three-line text header in front of an uncompressed raster of 32-bit IEEE 754 floating-point samples: an identifier that distinguishes single-channel from three-channel images, the width and height, and a signed number that carries the byte order. The format has no authoritative specification. Netpbm’s documentation says that several similar formats share the name and that it describes one deduced from existing software; Paul Debevec’s page describes the same layout. In a media pipeline, PFM is usually a working or interchange representation between numerical processing stages, not a final web or print asset.
Key facts
- Identify a PFM file by its first line:
PFmeans three samples per pixel (RGB) andPfmeans one (grayscale). The second line holds width and height, the third a signed number, and the raster follows immediately. Every sample is a 4-byte IEEE 754 float with no compression, so the raster takes width × height × 4 bytes for grayscale and three times that for color. The header has no other fields, and Debevec’s description allows no comments, so color space and units have to be agreed outside the file. - The sign of the third header value sets the byte order of the samples: negative means little-endian, positive means big-endian. Netpbm also reads the absolute value as a scale factor, to be combined with unit information understood separately, while Debevec’s description uses the number only for byte order. A reader that assumes the machine’s native byte order produces garbage for files written the other way, and a reader that drops the magnitude can misjudge absolute intensity if the writer relied on it.
- Rows run bottom to top in both Debevec’s and Netpbm’s descriptions, the opposite of Netpbm’s own PGM and PPM formats. Netpbm documents that the variant Adobe Photoshop calls PFM orders rows top to bottom, so files exchanged between the two conventions come out vertically flipped without any error. FFmpeg read and wrote PFM mirrored until a fix in late 2022. Check orientation with an asymmetric test image whenever a new tool joins the pipeline.
When PFM Files matter
Choose PFM for intermediate computer-vision, depth, scientific, or high-dynamic-range data when floating-point precision matters. Limited application support and endianness handling can complicate interchange.
How Transloadit helps with PFM Files
Transloadit’s image formats table, which covers its ImageMagick-based Robots such as /image/resize, lists PFM as a format those Robots can read and write.
The table records format-level read and write support only. It does not say how row order, the scale value, or float samples outside the displayable range are handled when converting to an integer format such as PNG or JPEG, so run a representative file through your Assembly and check orientation and brightness.
Explore Transloadit’s file formats & compression capabilities