| Name: | PFM | |||
| Also Known As: | Portable floatmap | |||
| Type: | Bitmap | |||
| Colors: | 3 times 32-bit floating point values | |||
| Compression: | None | |||
| Maximum Image Size: | NA | |||
| Multiple Image Per File: | No | |||
| Numerical Format: | Little-endian (common), big-endian (uncommon) | |||
| Originator: | Paul Debevec | |||
| Platform: | Any | |||
| Supporting Applications: | HDRShop,
Forklabs hdr-codec library, ImageConverter Plus, ImageDB, Adobe Photoshop CS2/CS3 | |||
| Specifications on CD: | No | |||
| Code on CD: | No | |||
| Images on CD: | No | |||
| See Also: | OpenEXR, Radiance, LogLUV TIFF, floating point TIFF | |||
| Usage: | Easy to read and write format for high dynamic range images applications | |
| Comments: | PFM is a simple intermediary format for high dynamic range images |
The PFM image file format is a format popularized by the high dynamic range image manipulation program HDRShop.
This format seeks to be an extension to the PNM image formats by Jef Poskanzer. As such, the PFM format is a
least-common-denominator easy to read and write. A reference implementation in C
(and C++) can be found in the sample plugin
for HDRShop. A Java implementation can also be found in the Forklabs hdr-codec library.
The PFM format is designed to be as simple as possible. The format starts out with a header, and the bitmap data follows immediately after. The header is always written in ASCII, and the data item are separated by whitespace (blanks, tabs, carriage returns, or linefeeds). The data portion is always written in binary form.
There are two version of the PFM header. Although both header are in ASCII format, one is used for the color version while the other is used for the greyscale version.
A color PFM header consists of the following entries, each separated by white space:
| MagicValue | Literally PF | |
| ImageWidth | Width of the image in pixels (ASCII decimal value). | |
| ImageHeight | Height of the image in pixels (ASCII decimal value). | |
| ByteOrder | The ordering of the bytes composing each 32-bit floating point value (ASCII floating point value). |
A greyscale PFM header consists of the following entries, each separated by white space:
| MagicValue | Literally Pf | |
| ImageWidth | Width of the image in pixels (ASCII decimal value). | |
| ImageHeight | Height of the image in pixels (ASCII decimal value). | |
| ByteOrder | The ordering of the bytes composing each 32-bit floating point value (ASCII floating point value). |
After the header is a series of lines describing width x
height pixels. For the color version, each pixels contains three
32-bit floating point values. The order of the pixels starts at the lower-left
corner of the pixmap, from left to right, bottom to top. The three values for
each pixel represent red, green and blue repectively. The greyscale pixel
version has only one value for each pixel.
Each 32-bit floating point value is encoded as four bytes. The order of these
bytes is little-endian if ByteOrder is less than or equal to zero
and big-endian otherwise.
You can include comments in the PFM file. Lines in the header before the
dimensions and after the magic number that begins with '#' to the
next end-of-line are ignored. Comments can also be included after the image
data.NOTE: Comments might not be parsed by all decoders.
This section presents two examples. The first example is a little-endian 1x1 color image with the red value being π (about 3.141592), the green value being e (the basis of the natural logarithm - about 2.718281) and the blue value being the golden ratio φ (about 1.618033). This example can be downloaded as a separate file.
The second example is a big-endian 3 rows by 1 column greyscale image, the topmost pixel is φ, the middle pixel e and lowest pixel π. This example can be downloaded as a separate file.
Please note that the binary data expressed is what the Eclipse IDE gave by opening the generated PFM in its text editor.
PF
1 1
-1.000000
ÛI@Tø-@½Ï?
The hexadecimal values of the pixel data is :
db f 49 40 54 f8 2d 40 bd 1b cf 3f
Pf
1 3
1.000000
@IÛ@-øT?Ͻ
The hexadecimal values of the pixel data is :
40 49 f db 40 2d f8 54 3f cf 1b bd
This example includes two comments lines. It adds them to the greyscale example above. NOTE: Comments might not be parsed by all decoders.
Pf
# first comment
# second comment
1
3
1.000000
@IÛ@-øT?Ͻ
For further information about the PFM image file format, you can contact:
Daniel Léonard" at " in the
address for "@" to be able to reach the desired person.