TOFITS(1)

✨ NAME ✨

okay so bestie, meet tofits β€” the lil tool that turns a list of keyrecords into a valid FITS file πŸ’– (it's in the User Commands section, so it's a real one, iykyk)

🌸 DESCRIPTION 🌸

So basically tofits takes a whole list of FITS header keyrecords β€” one per line, no cap β€” and glows them up into a proper FITS header. How? It pads every single one with blanks until it hits 80 characters and strips the newline characters out. πŸ’…

Then, if it needs to, it also pads the whole header so it lands on an integral number of 2880-byte blocks. Like, the header is not allowed to be a weird in-between size, periodt.


The input byte stream is assumed to be ASCII-encoded. And here's the tea β˜•: any characters that live outside the set of text characters FITS allows (that's ASCII 0x20 to 0x7E) get ignored πŸ™ˆ β€” with literally one single exception. If a byte has the value 0xA0 (which is the non-breaking space in all variants of ISO/IEC 8859), it gets translated into an ordinary space (0x20). So like, a little glow-up for that one byte. ✨

Which means input encoded in ISO/IEC 8859 or UTF-8 should be interpreted correctly! πŸŽ€ And any illegal characters sitting in keycomments? Just quietly ignored, no drama, we don't talk about them. πŸ’€

tofits has no options β€” zero, none, nothing to configure, she simply is β€” and it operates as a filter, reading from stdin and writing to stdout, e.g.

tofits < infile > outfile

And one more thing bestie: input lines beginning with '#' are treated as comments. Slay. πŸ’œ


mwah πŸ’‹ random date but iconic: this is tofits version 8.9, from June 2026 β€” go off, king πŸ‘‘

πŸ“¦ where this page comes from