summaryrefslogtreecommitdiffstats
path: root/upstream/opensuse-tumbleweed/man5/pfm.5
blob: c8266a9dc98c673f59ec0d024542fb5e438e5951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
\
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source.
.\" Do not hand-hack it!  If you have bug fixes or improvements, please find
.\" the corresponding HTML page on the Netpbm website, generate a patch
.\" against that, and send it to the Netpbm maintainer.
.TH "PFM Format Description" 5 "19 April 2012" "netpbm documentation"


.SH NAME

PFM - PFM graphic image file format

.SH DESCRIPTION
.PP
This document describes the PFM graphic image file format as understood by
the Netpbm converters
.BR "\fBpamtopfm\fP" (1)\c
\& and
.BR "\fBpfmtopam\fP" (1)\c
\&.
.PP
There are multiple similar formats known as PFM in the world, none
of them authoritatively documented.  The format described here is one
that Bryan Henderson deduced from a program he found somewhere that
dealt with a "PFM" format.
.PP
The PFM format is inspired by the Netpbm formats, and you will see
lots of similarity.  It is not, however, an official Netpbm format.
Its goal is not consistent with those of Netpbm formats.

.SH The format
.PP
A PFM image is a stream of bytes.  The stream consists of a header
followed immediately by a raster.  These two components are described
below.  There are no delimiters before or after the sections as
described.

.SS PFM header
.PP
The PFM header is 3 consecutive "lines" of ASCII text.
After each line is a white space character.  That character is
typically a newline character, hence the term "line," but
doesn't have to be.
.PP
\fBpamtopfm\fP uses a newline in the PFM it generates.

.B Identifier Line
.PP
The identifier line contains the characters "PF" or
"Pf".  PF means it's a color PFM.  Pf means it's a grayscale
PFM.

.B Dimensions Line
.PP
The dimensions line contains two positive decimal integers,
separated by a blank.  The first is the width of the image; the second
is the height.  Both are in pixels.

.B Scale Factor / Endianness
.PP
The Scale Factor / Endianness line is a queer line that jams
endianness information into an otherwise sane description of a scale.
The line consists of a nonzero decimal number, not necessarily an
integer.  If the number is negative, that means the PFM raster is
little endian.  Otherwise, it is big endian.  The absolute value of
the number is the scale factor for the image.
.PP
The scale factor tells the units of the samples in the raster.  You
use somehow it along with some separately understood unit information
to turn a sample value into something meaningful, such as watts per
square meter.


.SS PFM raster
.PP
The raster is a sequence of pixels, packed one after another, with no
delimiters of any kind.  They are grouped by row, with the pixels in each
row ordered left to right and the rows ordered bottom to top.
.PP
Each pixel consists of 1 or 3 samples, packed one after another,
with no delimiters of any kind.  1 sample for a grayscale PFM and 3 for a
color PFM (see the Identifier Line of the PFM header).
.PP
Each sample consists of 4 consecutive bytes.  The bytes represent a
32 bit string, in either big endian or little endian format, as determined
by the Scale Factor / Endianness line of the PFM header.  That string is
an IEEE 32 bit floating point number code.  Since that's the same format
that most CPUs and compiler use, you can usually just make a program use
the bytes directly as a floating point number, after taking care of the
endianness variation.
.SH DOCUMENT SOURCE
This manual page was generated by the Netpbm tool 'makeman' from HTML
source.  The master documentation is at
.IP
.B http://netpbm.sourceforge.net/doc/pfm.html
.PP