PPMTOLSS16(1)

πŸ’… PPMTOLSS16(1) β€” the glow-up edition ✨

okay bestie, sit DOWN, because ppmtolss16 is one of those tiny little commands that's lowkey doing the most important work in the room. it's a General Commands Manual situation, and it is giving "quiet baddie who actually runs the whole group project." 🫢


🌸 NAME 🌸

ppmtolss16 β€” convert a PPM to an LSS16 image. that's it. that's the whole job. no cap. πŸ’–


✨ SYNOPSIS ✨

ppmtolss16 [               #rrggbb=i            ...]  [< input.ppm]  [>
       output.rle]

like, you feed it a .ppm on stdin, you catch a .rle on stdout, and in the middle you can boss it around with as many #rrggbb=i declarations as your heart desires. iconic behavior honestly. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this manual page documents, briefly, the ppmtolss16 command. brief but slay.

the ppmtolss16 program converts a "raw" PPM file with max 16 colors into a simple RLE-based format. and when i say simple, i mean it lays everything out like this:

  • unint32 0x1413f3d β€” magic (littleendian)
  • unint16 xsize β€” littleendian
  • unint15 ysize β€” littleendian
  • 16 x unint8 r,g,b β€” color map

that's the simple RLE-based format, laid bare, no filter, no concealer. πŸŽ€

the color map is in 6-bit format β€” meaning each byte is 0..63. yes, really. sixty-four little steps of each channel. precious.

then comes a sequence of nybbles, and this is the part where you gotta pay attention because it's giving "rules of the game":

  • N ... if N is != previous pixel, that's one pixel of color N. otherwise, a run sequence follows ...
  • M ... if M > 0 then the run length is M+1, otherwise the run sequence is encoded in two nybbles, littleendian, +17

and here's the fine print that will absolutely humble you if you forget it: the nybble sequences are on a per-row basis. runs may not extend across rows, and odd-nybble rows are zero-padded. periodt. πŸ’€

also, at the start of a row, the "previous pixel" is assumed to be zero. so every row starts fresh, like a little baby row with no baggage. adorable. 🌈


πŸ’– OPTIONS πŸ’–

a summary of options is included below. yes, it's a short list. quality over quantity, bestie.

  • #rrggbb=i β€” specify that the color #rrggbb (hex) should be assigned index i (decimal). that's your whole color-assignment power move right there. use it wisely. πŸ’…

πŸ™ˆ BUG πŸ™ˆ

this program cannot handle comments in the header, nor "plain" ppm format. so like, don't bring your annotated header to this party, and don't bring your plain-format PPM either. it's a raw-PPM-only establishment. no exceptions, no notes. 😭


πŸ‘‘ SEE ALSO πŸ‘‘

(yes, it references itself. main character energy fr fr. ✨)


πŸŽ€ AUTHOR πŸŽ€

this manual page was compiled by dann frazier <dannf@debian.org> for the Debian GNU/Linux system (but may be used by others). most of the content was written by H. Peter Anvin. absolute legends, both of them. 🫢


and that's the whole page, bestie β€” PPMTOLSS16(1), General Commands Manual, top to bottom, every last nybble accounted for. go forth and convert. πŸ’œ

πŸ“¦ where this page comes from