PAMENDIAN(1)
π« PAMENDIAN(1) β the pamendian user manual, bestie edition π«
okay so welcome to the pamendian manual, part of the Netpbm family, general commands section, and yes i'm about to make byte order genuinely fun. buckle up π
β¨ NAME β¨
pamendian β flips the endianness of a Netpbm image, no cap π
πΈ SYNOPSIS πΈ
pamendian
that's it. that's the whole vibe. no args, no flags, just vibes and stdin π
π¦ DESCRIPTION π¦
so first things first: this program is part of Netpbm(1). family reunion energy π
here's the lore. every Netpbm format that has samples in pure binary format with multiple bytes is defined to keep them in big endian order, aka most significant byte first. periodt. that's the official rule π
BUT. there exist variations on these formats β mostly cooked up back before official multibyte Netpbm formats even existed β that are identical to Netpbm formats in literally every respect except one: their samples are in little endian order, meaning least significant byte first. chaotic, but real π
pamendian reverses the byte order of the sample to convert between the two formats. so if your input is true PAM, PGM, or PPM, the output is the little endian variation on that format β and if your input is the little endian variation, you get the true one back. it goes both ways, she's versatile π
who even uses this variant, you ask? the X Window System viewer xv expects the little endian variation of PGM and PPM. and the programs that ship with the Independent Jpeg Group's JPEG library are known to use the little endian variation of PGM and PPM too. so it's not just a random curse, there are witnesses π
the reason some programs use this variant? messy history. at one time during Netpbm's dark age(1), there was a version of Netpbm floating around that used it. but it was never formally specified. it's giving unhinged era π
this program takes input only on Standard Input. its output is always on Standard Output. no file arguments, no exceptions π«Ά
and now the part where i have to be a little stern with you π you should never have to use this program with images generated by programs in the Netpbm package, or programs that use the Netpbm libraries. if you do, that probably means something needs to be fixed in those programs. the Netpbm converter for any graphics format that represents numbers in little endian form should properly reverse the bytes to create correct Netpbm output. that's their job. not yours. let them cook π₯
and if you're creating a Netpbm image from a generic stream of samples using rawtopgm or rawtoppm, use options on those programs to declare the endianness of your input β that way you get correct endianness in your PGM or PPM output from the jump. work smarter, not harder β¨
π OPTIONS π
there are no command line options defined specifically for pamendian, bestie, she's a one-trick pony and she's iconic for it.
but β and this is important β it does recognize the options common to all programs based on libnetpbm. (See Common Options.) so those ones still work, iykyk π
π SEE ALSO π
pamdepth(1)rawtopgm(1)rawtoppm(1)pnm(1)
π DOCUMENT SOURCE π
this manual page was generated by the Netpbm tool makeman from HTML source, which is very slay of it. the master documentation lives at:
http://netpbm.sourceforge.net/doc/pamendian.html
okay bestie that's the whole page, you ate it, go reverse some bytes responsibly π§π
netpbm documentation, dated 16 March 2002 β Pamendian User Manual energy all the way to the end, mwah ππΈβ
π¦ where this page comes from
- debian bookworm: netpbm 2:11.01.00-2 Β· MIT
- debian trixie: netpbm 2:11.10.02-1 Β· MIT
- ubuntu noble: netpbm 2:11.05.02-1.1build1 Β· MIT
- ubuntu resolute: netpbm 2:11.10.02-1build1 Β· MIT
- ubuntu stonking: netpbm 2:11.13.03+ds-2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms