PAMTOFITS(1)

πŸ“¦
version 11.13.03 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’« PAMTOFITS β€” the Pamtofits User Manual, bestie edition πŸ’«

okay so real quick, this is from the General Commands Manual section of your friendly neighborhood pamtofits user manual, and it's about to be your new fave little conversion tool. let's get into it 🫢


✨ NAME ✨

pamtofits β€” convert a Netpbm image into FITS format πŸ’…


🌈 SYNOPSIS 🌈

pamtofits [-max f] [-min f] [pamfile]

πŸ’– DESCRIPTION πŸ’–

hii so first things first: this program is part of Netpbm(1). love that for it.

pamtofits reads a PNM or PAM image as input and produces a FITS (Flexible Image Transport System) file as output. iconic honestly. ✨

the resolution of the output file is either 8 bits/pixel or 16 bits/pixel, and which one you get depends on the value of maxval in the input file. no cap.

and about the shape of the thing:

  • 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).

periodt. πŸ’…


🌸 OPTIONS 🌸

besides the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pamtofits recognizes these command line options, bestie:

  • -min, -max β€” these tell pamtofits what "physical values" the zero and maxval sample values (respectively) in the input image represent. physical values are a FITS concept, iykyk. pamtofits sets up the BSCALE and BZERO FITS header cards to indicate this information.

and the deets on defaults: the default for -min is 0 and the default for -max is the maxval. which means if you don't specify these options, the FITS physical values are actually, literally, just the original Netpbm sample values. slay, no conversion drama. πŸŽ€

okay and one more thing β€” pamtofits always sets up the FITS header DATAMIN and DATAMAX cards to indicate that the highest physical value in the image is the one corresponding to the Netpbm maxval and the lowest is the one corresponding to Netpbm zero. and ngl, 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's a conservative approximation. so like, close enough energy but do keep that in mind. πŸ™ˆ


πŸ¦‹ NOTES πŸ¦‹

πŸ‘‘ Pixel Order πŸ‘‘

okay this part is important so pay attention bestie.

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.). so it's giving... unspecified. πŸ’€

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. and within each row, the first pixel is the leftmost one and the last pixel is the rightmost one. makes sense, we love a consistent queen. πŸ‘‘

Netpbm has always done that, ever since it first understood the FITS format in 1989, so it's something of a de facto standard. and nobody reported trouble with that until 2008. not one single person, until then. 😭

however β€” at least some versions of ImageMagick and Gimp (as seen in 2008) use bottom to top order. so if you use one of these to display a FITS image generated by pamtofits, it will appear upside down. 😭 not the vibe.

to fix that, use pamflip -topbottom on the image before feeding it to pamtofits. problem solved, we move. ✨

and since 2008, people have noted that NASA distributes FITS files with bottom to top order. so yeah. πŸš€


πŸ’œ HISTORY πŸ’œ

  • pamtofits was originally pnmtofits and did not handle PAM input. it was extended and renamed in Netpbm 10.30 (October 2005). glow up honestly.
  • pnmtofits was itself an extension of pgmtofits, which was added to Pbmplus in 1989. we love a lineage. 🌈

⭐ SEE ALSO ⭐


πŸŽ€ AUTHOR πŸŽ€

Copyright (C) 1989 by Wilson H. Bent (whb@hoh-2.att.com), with modifications by Alberto Accomazzi (alberto@cfa.harvard.edu). legends only, fr fr. 🫢


πŸ“œ DOCUMENT SOURCE πŸ“œ

This manual page was generated by the Netpbm tool makeman from HTML source. The master documentation is at

http://netpbm.sourceforge.net/doc/pamtofits.html

and that's the whole page bestie!! no skips, no cuts, every flag accounted for πŸ’–

okay bye ily, this was netpbm documentation, edition 25 September 2005, and the page is literally called the Pamtofits User Manual(1). go convert some pixels. mwah πŸ’…βœ¨

πŸ“¦ where this page comes from