summary refs log tree commit diff
path: root/pamtofits.html
blob: 24446081f39140402a7eec0980de8c4bd8dbf1da (plain) (blame)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.3//EN">
<html><head><title>Pamtofits User Manual</title></head>
<body>
<h1>pamtofits</h1>
Updated: 25 September 2005
<br>
<a href="#index">Table Of Contents</a>

<h2>NAME</h2>

pamtofits - convert a Netpbm image into FITS format

<h2 id="synopsis">SYNOPSIS</h2>

<b>pamtofits</b>
[<b>-max</b> <i>f</i>]
[<b>-min</b> <i>f</i>]
[<i>pamfile</i>]

<h2 id="description">DESCRIPTION</h2>

<p>This program is part of <a href="index.html">Netpbm</a>.

<p><b>pamtofits</b> reads a PNM or PAM image as input and produces a FITS
(Flexible Image Transport System) file as output.  The resolution of
the output file is either 8 bits/pixel, or 16 bits/pixel, depending on
the value of maxval in the input file.  If the input file is a PBM or
PGM image, the output file consists of a single plane image (NAXIS =
2). If instead the input file is a PPM image, the output file will
consist of a three-plane image (NAXIS = 3, NAXIS3 = 3).

<h2 id="options">OPTIONS</h2>

<p>In addition to the options common to all programs based on libnetpbm
(most notably <b>-quiet</b>, see <a href="index.html#commonoptions">
Common Options</a>), <b>pamtofits</b> recognizes the following
command line options:

<p><b>-min</b> and <b>-max</b> tell <b>pamtofits</b> what "physical
values" zero and maxval sample values, respectively, in the input
image represent.  Physical values are a FITS concept.  <b>pamtofits</b>
sets up the <b>BSCALE</b> and <b>BZERO</b> FITS header cards to indicate
this information.

<p>The default for <b>-min</b> is 0 and for <b>-max</b> is the maxval,
which means if you don't specify these options, the FITS physical values
are in fact the original Netpbm sample values.

<p><b>pamtofits</b> always sets up the FITS header <b>DATAMIN</b> and
<b>DATAMAX</b> cards to indicate that the highest physical value in
the image is the one corresponding to the Netpbm maxval and the lowest is
that corresponding to Netpbm zero.  This isn't really how those cards are
supposed to be used, since the input image doesn't necessarily contain
the full possible range of sample values.  It is a conservative
approximation.

<h2 id="notes">NOTES</h2>

<h3 id="pixelorder">Pixel Order</h3>

<p>The FITS specification does not specify which data in the file corresponds
to which pixel in the image (i.e. which bytes are the top left pixel,
etc.).  Netpbm uses the common sense, most popular arrangement: row major, top
to bottom, left to right.  That means in a 10 wide by 20 high image, the first
10 pixels in the file are the top row and the last 10 are the bottom row.
Within each row, the first pixel is the leftmost one and the last pixel is
the rightmost one.

<p><b>Netpbm</b> has always done that, since it first understood the
FITS format in 1989, so it is something of a de facto standard.  Nobody
reported trouble with that until 2008.

<p>However, at least some versions of ImageMagick and Gimp (as seen in 2008)
use bottom to top order, so if you use on of these to display a FITS image
generated by <b>pamtofits</b>, it will appear upside down.  To fix that,
use <b>pamflip -topbottom</b> on the image before feeding it
to <b>pamtofits</b>.

<p>Since 2008, people have noted that NASA distributes FITS files with
bottom to top order.


<h2 id="history">HISTORY</h2>

<p><b>pamtofits</b> was originally <b>pnmtofits</b> and did not handle
PAM input.  It was extended and renamed in Netpbm 10.30 (October 2005).

<p><b>pnmtofits</b> was itself an extension of <b>pgmtofits</b>, which
was added to Pbmplus in 1989.

<h2 id="seealso">SEE ALSO</h2>

<a href="fitstopnm.html">fitstopnm</a>,
<a href="pam.html">pam</a>

<h2 id="author">AUTHOR</h2>

Copyright (C) 1989 by Wilson H. Bent (<a
href="mailto:whb@hoh-2.att.com">whb@hoh-2.att.com</a>), with
modifications by Alberto Accomazzi (<a
href="mailto:alberto@cfa.harvard.edu">alberto@cfa.harvard.edu</a>).

<hr>
<h2 id="index">Table Of Contents</h2>
<ul>
<li><a href="#synopsis">SYNOPSIS</a>
<li><a href="#description">DESCRIPTION</a>
<li><a href="#options">OPTIONS</a>
<li><a href="#notes">NOTES</a>
  <ul>
  <li><a href="#pixelorder">Pixel Order</a>
  </ul>
<li><a href="#history">HISTORY</a>
<li><a href="#seealso">SEE ALSO</a>
<li><a href="#author">AUTHOR</a>
</ul>
</body>
</html>