summary refs log tree commit diff
path: root/pamtofits.html
blob: 0ecc80648ad3ff4b3cb7eb39ee2025d9e4c09c3c (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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//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><b>-min</b> and <b>-max</b> tell <b>pamtofits</b> what &quot;physical
values&quot; 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 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>