Debian Codegraph @

upstream/debian-unstable/man5/pfm.5

raw
1 \
2 .\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
3 .\" Do not hand-hack it! If you have bug fixes or improvements, please find
4 .\" the corresponding HTML page on the Netpbm website, generate a patch
5 .\" against that, and send it to the Netpbm maintainer.
6 .TH "PFM Format Description" 5 "27 February 2024" "netpbm documentation"
7
8
9 .SH NAME
10
11 PFM - PFM graphic image file format
12
13 .SH DESCRIPTION
14 .PP
15 This document describes the PFM graphic image file format as understood by
16 the Netpbm converters
17 .BR "\fBpamtopfm\fP" (1)\c
18 \& and
19 .BR "\fBpfmtopam\fP" (1)\c
20 \&.
21 .PP
22 There are multiple similar formats known as PFM in the world, none of them
23 authoritatively documented. The format described here is one that Bryan
24 Henderson deduced from a program he found somewhere that dealt with a "PFM"
25 format. This format appears to be the one Gimp calls PFM.
26
27 Another important PFM is used by Adobe Photoshop and appears to be identical
28 to this except that rows are ordered from top to bottom in the Adobe version.
29 If you interchange images between systems that use these two formats, it will
30 work except that your image gets flipped upside down. You can compensate for
31 that with \f(CWpamflip -topbottom\fP.
32 .PP
33 The PFM format is inspired by the Netpbm formats, and you will see lots of
34 similarity. It is not, however, an official Netpbm format. Its goal is not
35 consistent with those of Netpbm formats.
36
37 .SH The format
38 .PP
39 A PFM image is a stream of bytes. The stream consists of a header
40 followed immediately by a raster. These two components are described
41 below. There are no delimiters before or after the sections as
42 described.
43
44 .SS PFM header
45 .PP
46 The PFM header is 3 consecutive "lines" of ASCII text.
47 After each line is a white space character. That character is
48 typically a newline character, hence the term "line," but
49 doesn't have to be.
50 .PP
51 \fBpamtopfm\fP uses a newline in the PFM it generates.
52
53 .B Identifier Line
54 .PP
55 The identifier line contains the characters "PF" or
56 "Pf". PF means it's a color PFM. Pf means it's a grayscale
57 PFM.
58
59 .B Dimensions Line
60 .PP
61 The dimensions line contains two positive decimal integers,
62 separated by a blank. The first is the width of the image; the second
63 is the height. Both are in pixels.
64
65 .B Scale Factor / Endianness
66 .PP
67 The Scale Factor / Endianness line is a queer line that jams
68 endianness information into an otherwise sane description of a scale.
69 The line consists of a nonzero decimal number, not necessarily an
70 integer. If the number is negative, that means the PFM raster is
71 little endian. Otherwise, it is big endian. The absolute value of
72 the number is the scale factor for the image.
73 .PP
74 The scale factor tells the units of the samples in the raster. You
75 use somehow it along with some separately understood unit information
76 to turn a sample value into something meaningful, such as watts per
77 square meter.
78
79
80 .SS PFM raster
81 .PP
82 The raster is a sequence of pixels, packed one after another, with no
83 delimiters of any kind. They are grouped by row, with the pixels in each
84 row ordered left to right and the rows ordered bottom to top.
85 .PP
86 \fINote:\fP This is the opposite of Netpbm formats, which order rows
87 top to bottom. It is also the opposite of the format Adobe Photoshop calls
88 PFM. See the introduction for more information on this disparity.
89
90 .PP
91 Each pixel consists of 1 or 3 samples, packed one after another,
92 with no delimiters of any kind. 1 sample for a grayscale PFM and 3 for a
93 color PFM (see the Identifier Line of the PFM header).
94 .PP
95 Each sample consists of 4 consecutive bytes. The bytes represent a
96 32 bit string, in either big endian or little endian format, as determined
97 by the Scale Factor / Endianness line of the PFM header. That string is
98 an IEEE 32 bit floating point number code. Since that's the same format
99 that most CPUs and compiler use, you can usually just make a program use
100 the bytes directly as a floating point number, after taking care of the
101 endianness variation.
102 .SH DOCUMENT SOURCE
103 This manual page was generated by the Netpbm tool 'makeman' from HTML
104 source. The master documentation is at
105 .IP
106 .B http://netpbm.sourceforge.net/doc/pfm.html
107 .PP